Search code examples
iphoneiosmkmapviewaccessoryview

Callout accessory without accessory button


Is it possible to make a call out accessory view in mapview without an accessory button in it. I am loading a mapview. In some cases, on tapping the pin, I need to show the accessory view, but without an accessory button to tap. Is it possible? If so, how?


Solution

  • Have you looked at the viewForAnnotation delegate? Using this delegate you can create a custom view for when the pin is tapped.

    In here you can do something like this:

    MKPinAnnotationView *aView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myPinView"];
    aView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    

    If you don't set rightCalloutAccessoryView then there will be no accessory button.

    Hope this gets you on the right track.