Wanted some help with a problem with mapkit I am facing. Should be a silly problem or I have missed out something while going through the mapkit framework.
Here is the senario.
I am placing multiple annotation on the map when the user performs some search like pizza.
Added button for the right annotation view, on click which opens a next detail view. The problem is how to send some information to the next view, for example I add index to annotations while creating them, now I want to access this information from annotation, and pass it to the next view via the selector set on the button.
I have checked all the mapkit delicate, but don’t find a one where I can map this information with the next view and annotation.
Hope I have not confused you guys in my question. Please let me know I will reframe it.
Thaking in advance.
When you create the
UIButtonfor the annotation, set thetagproperty (tag is anNSIntegerproperty ofUIView) to an id or array index that identifies the relevant object. You can then retrieve that tag value from thesenderparameter to your selector.Edit: here’s some sample code.
You create your annotation view and associate the button in your delegate’s -mapView:viewForAnnotation: method:
}
Then in your action method, you’ll unpack the value from
tagand use it to display the right detail: