Arvis,
I'm doing something similar in an app I'm currently working on. But I just 
remove all the annotations and then reload them.

The effect is that when the map is scrolled or zoomed, all pins disappear and 
then reappear.

Bob

--
Bob Reck <[email protected]<mailto:[email protected]>>
PII Quality Assurance Auditor
Senior Applications Developer
___________________
www.keylogic.com<http://www.keylogic.com/>
443.539.9065
301.621.8920 (fax)

The information contained in this message may be privileged, private and 
protected from disclosure. If the reader of this message is not the intended 
recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited. If you 
have received this message in error, please notify us immediately by replying 
to the message.

On Oct 5, 2012, at 9:12 AM, "Nic Wise" 
<[email protected]<mailto:[email protected]>> wrote:

Do you need to tell the MKMapView that it need to redraw everything?
Same as you sometimes do with a view?

On Fri, Oct 5, 2012 at 1:45 PM, Arvis Lieģenieks 
<[email protected]<mailto:[email protected]>> wrote:
What I'm trying to accomplish is to update collections of MyAnnotations
already added in MapView:

Dictionary<long, MyAnnotation> _annotations;

private void OnUpdate(Dictionary<uint, MyObject> updatedObjects)
{
   // Add or Update annotations on map
   foreach (var pair in updatedObjects)
   {
       uint id = pair.Key;
       MyObject obj = pair.Value;

       double lat = obj.Latitude;
       double lon = obj.Longitude;

       if (_annotations.ContainsKey(key)) // Update existing objects
       {
           _annotations[id].Coordinate = new CLLocationCoordinate2D(lat,
lon);
           _annotations[id].Obj = obj;
       }
       else // Add new object to map
       {
           var annotation = new MyAnnotation(new
CLLocationCoordinate2D(lat, lon), obj);
           _annotations.Add(id, annotation);
           InvokeOnMainThread(() => MapView.AddAnnotation(annotation));
       }
   }
}


but annotations does not get updates!!!

Does MapView receive KVO notifications automaticly when
MKAnnotation.Coordinate property has been changed and what is the
AddAnnotationObject methode for?

Falowed by this thread (
http://monotouch.2284126.n4.nabble.com/setCoordinate-binding-td3799997.html
)
made my annotation (but not help - annotation did not change coordinates):

       protected class MapAnnotation : MKAnnotation
       {
           private CLLocationCoordinate2D _coordinate;

           public MapAnnotation(CLLocationCoordinate2D coordinate, MyObject
obj)
           {
               _coordinate = coordinate;
               Obj = obj;
           }

           public override sealed CLLocationCoordinate2D Coordinate
           {
               get { return _coordinate; }
               set
               {
                   WillChangeValue("coordinate"); // supose to triger
MapView KVO
                   _coordinate = value;
                   DidChangeValue("coordinate"); // supose to triger
MapView KVO
               }
           }

           public override string Title
           {
               get { return Obj.MyTitle; }
           }

           public override string Subtitle
           {
               get { return Obj.MySubtitle; }
           }

           public Object Obj { get; set; }
       }

_______________________________________________
MonoTouch mailing list
[email protected]<mailto:[email protected]>
http://lists.ximian.com/mailman/listinfo/monotouch




--
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]<mailto:[email protected]>
http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to