0

How can I go about making a view transition from when a map annotation rightCalloutVccessoryView is pressed?

Right now, that button triggers a segue for me (I added a target to the button), but I need that segue to happen with some special properties that the annotation carries.

I tried subclassing the button to hold the properties that I need, but that didnt work 100% right. Also, Ive tried using this category, https://github.com/woxtu/UIButton-WithObject, but it has a bug. I've tried associated objects, as per this solution, Subclass UIButton to add a property, but it works the same as the subclass does.

Community
  • 1
  • 1
SleepsOnNewspapers
  • 3,353
  • 3
  • 23
  • 29

1 Answers1

1

You don't need any segue linked to the button, nor any categories.

You can implement mapView:annotationView:calloutAccessoryControlTapped: of the MKMapViewDelegate. You can then programmatically perform the segue between the two scenes and have prepareForSegue pass the necessary information, or you can manually instantiate the next scene (calling the storyboard's instantiateViewControllerWithIdentifier), set the properties you want, and then push/present that view controller.

Rob
  • 415,655
  • 72
  • 787
  • 1,044