Hi Chris,

Reading the developer documentation on Apple's site for MKAnnotation,
this is what it says for setCoordinate:

setCoordinate:
Sets the new center point of the annotation.

- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate
Parameters
newCoordinate
The new center point for the annotation.
Discussion
Annotations that support dragging should implement this method to
update the position of the annotation.

Availability
Available in iOS 4.0 and later.
Declared In
MKAnnotation.h


Calling setCoordinate() in Objective-C will not magically make your
annotation update its location on the screen. You'll have to use a
similar trick as to what I suggested to make it work in Objective-C as
well.

To the best of my understanding, this method doesn't move the
MKAnnotation on the map like you seem to believe, it gets set by the
MKMapView when the user drags the annotation to another location.

If I'm wrong, please provide me with some documentation explaining why
I'm wrong (preferably Apple documentation) or at least an Objective-C
program demonstrating it.

Jeff

On Thu, Sep 15, 2011 at 12:41 PM, Chris Hamblett <c_hambl...@hotmail.com> wrote:
> Since the bug has been changed to resolved without actually solving the 
> problem, I take this as a good reason that Objective-C will always have 
> functions that cannot be done through MonoTouch. I guess I will be making the 
> switch back to xCode.
>
> Sent from my iPhone
>
> On Sep 15, 2011, at 12:19 PM, "Jeff Stedfast" <j...@xamarin.com> wrote:
>
>> Hi Chris,
>>
>> I've taken a look at this and the problem is that once an
>> MKAnnotationView is created for your MKAnnotation subclass, you are
>> doing nothing to signal to the MKMapView that anything has changed.
>> Setting a new coordinate on your MKAnnotation subclass has no way of
>> notifying the parent MKMapView that it needs to redraw.
>>
>> Here's what I suggest you do:
>>
>> In your MKAnnotation subclass (MyAnnotation), add an event that gets
>> emitted when you set/change the coordinate. Then, have your
>> ViewController that owns the MKMapView listen for those events on each
>> of your MyAnnotations. When the event is emitted, have your
>> ViewController remove the annotation and re-add it.
>>
>> I tested this and it works.
>>
>> Jeff
>>
>> On Thu, Sep 15, 2011 at 9:26 AM, Chris Hamblett <c_hambl...@hotmail.com> 
>> wrote:
>>> I've added self-contained sample code to Bug 724
>>> bug 724
>>> Any updates on a binding that sets off the MapView KVO flag? Is this fixed
>>> on a new development build?
>>> ~Chris
>>> _______________________________________________
>>> MonoTouch mailing list
>>> MonoTouch@lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>>
>>>
>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to