leftCalloutAccessoryView getter not called

67 views
Skip to first unread message

jonathan.nyc

unread,
Feb 7, 2012, 9:22:54 AM2/7/12
to iPhone SDK Development
I'm running a subclass of MKAnnotationView. Nearly everything I've
coded has been confirmed as working.

The problem is I've coded an override of leftCalloutAccessoryView,
just to confirm the method is being called, pasted below. The output
from NSLog isn't appearing.

I've set canShowCallout = YES, and the callout appears without the
left accessory.

Any tips as to what the problem is getting this method to run and the
left accessory to appear?

Thanks,
Jonathan

-(UIView *) leftCalloutAccessoryView{

NSLog(@"left callout accessory view getter method called");
return [super leftCalloutAccessoryView];
}

Jesse Tayler

unread,
Feb 7, 2012, 9:33:11 AM2/7/12
to iphonesdkd...@googlegroups.com
I've not done that before, but are you certain you are returning your own class?

- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id <MKAnnotation>)annotation

> --
> You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
> To post to this group, send email to iphonesdkd...@googlegroups.com.
> To unsubscribe from this group, send email to iphonesdkdevelop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/iphonesdkdevelopment?hl=en.
>

jonathan.nyc

unread,
Feb 7, 2012, 10:15:45 AM2/7/12
to iPhone SDK Development
The leftCalloutAccessoryView is defined as UIView * in Apple's
documentation:
https://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKAnnotationView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40008207

which matches my own method definition.

Jesse Tayler

unread,
Feb 7, 2012, 10:24:12 AM2/7/12
to iphonesdkd...@googlegroups.com
right, so you've used the first API to let the map view present a pin bearing your MKAnnotationView subclass, which you return from the API method, correct?

then, the leftCallout is indeed a view and I don't see why your method would not get called as the view is loaded for the annotation when the user taps on a pin.

are you logging or breaking on the init of your annotation subclass to ensure it is indeed being loaded ?

jonathan.nyc

unread,
Feb 7, 2012, 11:31:35 AM2/7/12
to iPhone SDK Development
An instance method that I wrote (not an override) has been confirmed
to run correctly, so I am sure initialization has been completed.

On Feb 7, 10:24 am, Jesse Tayler <jtay...@oeinc.com> wrote:
> right, so you've used the first API to let the map view present a pin bearing your MKAnnotationView subclass, which you return from the API method, correct?
>
> then, the leftCallout is indeed a view and I don't see why your method would not get called as the view is loaded for the annotation when the user taps on a pin.
>
> are you logging or breaking on the init of your annotation subclass to ensure it is indeed being loaded ?
>
> On Feb 7, 2012, at 10:15 AM, jonathan.nyc wrote:
>
>
>
>
>
>
>
> > The leftCalloutAccessoryView is defined as UIView * in Apple's
> > documentation:
> >https://developer.apple.com/library/ios/#documentation/MapKit/Referen...
Reply all
Reply to author
Forward
0 new messages