I just spent a day figuring this out, so figured I'd share it with the world because I'm sure other people are going to want to know how to do this...
So the question is,
How can I get my MKMapView to respond to coordinate changes in my custom MKAnnotations?
As it turns out, this is incredibly simple. In your MKAnnotation subclass, whenever you want to change your Coordinate property value, you need to do the following:
void UpdateCoordinate (CLLocationCoordinate2D newCoordinate) { this.WillChangeValue ("coordinate"); this.Coordinate = newCoordinate; this.DidChangeValue ("coordinate"); }
That's it! It really is that simple...
The reason this works is because MKMapView observes changes in its list of MKAnnotations, you just need to signal to it that changes are about to happen (and did happen).
Happy hacking!
No comments:
Post a Comment