简体   繁体   中英

DidSelectAnnotationView method is not getting called

I am implementing ordnance survey maps. I am able to display all annotations but didSelectAnnotationView method is not calling when tap on annotation.

Here is the code, i have used below in viewForAnnotation method.

OSAnnotationView *view = nil;
static NSString *pinAnnotation = @"PinAnnotation";
view = [self.mapView dequeueReusableAnnotationViewWithIdentifier:pinAnnotation];
if (view == nil) {
    view = [[OSAnnotationView alloc] initWithAnnotation : annotation reuseIdentifier : pinAnnotation];
}

i have set delegate to self and able to call all delegate methods except didSelectAnnotationView.

Can anyone answer this please?

Thanks

I had a look at OSAnnotationView's documentation and saw that it has an image property. Try setting it to something non-nil and I think didSelectAnnotationView will work then. Also, try setting its title property to an empty string, if the setting the image property to non-nil doesn't work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM