Declare an instance variable in the class that contains the code you posted.
Building *buildingOfInterest;
then
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
for (Building* theBuilding in self.datacontroller.masterArray)
if(theBuilding.name isEqualToString:view.annotation.title) {
buildingOfInterest = theBuilding;
[self performSegueWithIdentifier:@"ShowBuildingSegue" sender:self];
break;
}
}
then:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"ShowBuildingSegue"])
((MyBuildingVC *)segue.destinationViewController).building = buildingOfInterest;
}
and in your target view controller's header file:
@interface MyBuildingVC : UIViewController
@property (strong) Building * building;
@end