Pergunta

Basically my program displays many annotations on a map. after the user clicks on one, It displays the title of the location. How can I add a button under the title that will display a new window with more information on the location? I would also be content with a button at the bottom of the screen that is greyed out until one location is selected.

Foi útil?

Solução

In the viewForAnnotation method, set a button as the callout accessory view:

annotationView.canShowCallout = YES;
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.rightCalloutAccessoryView = button;

You can use rightCalloutAccessoryView or leftCalloutAccessoryView but the documentation recommends putting a disclosure button on the right.

Respond to the button press in the calloutAccessoryControlTapped method.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top