0

I have multiple pins and callouts on my map view. When I press the details button I would like it go to details page. I want to add a hidden id to the callout so I know which details page to send the user to.

Is this possible / is there another way of doing this?

Here is my Code if it helps.

Thanks for helping.

Will
  • 3,004
  • 29
  • 43

2 Answers2

2

Your MKAnnotationView has a reference to the annotation which the view is generated from. This value is an object conforming to the MKAnnotation protocol, which you can use to find the information associated with the pin view.

J2theC
  • 4,412
  • 1
  • 12
  • 14
  • but cant you only use setCoordinate: and setTitle:? – Will Oct 23 '12 at 16:26
  • it's an object conforming to a protocol. You should find the class you used conforming to the protocol (the object you used when calling [makView addAnnotation:yourAnnotation]). – J2theC Oct 23 '12 at 16:29
  • Im sorry I dont quite understand. could you possibly show me? – Will Oct 23 '12 at 16:33
1

Here's some great information, already on stackoverflow. The example and answer describe the mkannotation protocol. Apple's documentation for this is also very good. Here's apple's information on the protocol, and apple's overall documentation for mapkit.

Basically what you do is you create your own class, make sure it conforms to the protocol, and you're good.

Community
  • 1
  • 1
Chris
  • 1,013
  • 1
  • 15
  • 35