Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

johnmerlino

macrumors member
Original poster
Oct 22, 2011
81
0
Usually, when I want to set the variable of another view controller within a specific view controller, I do this:

Code:
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
           MyOtherViewController *_vc = [segue destinationViewController]; 
          [_vc setUser:current_user];
}

Now here's my problem. I am not using the prepareForSegue method in the case where a user clicks an annotation on mapkit:

Code:
- (void)mapView:(MKMapView *)mapView 
 annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
    
    NSLog(@"my current report is %@", view.annotation);

    if ([(UIButton*)control buttonType] == UIButtonTypeDetailDisclosure){
        [self performSegueWithIdentifier:@"ShowRemoteDetailViewManagerController" sender:self];        
    }
}

So in the above case, I have no access to a segue parameter to target the destination controller to set the view.annotation as the value of one of its methods. So how would I target the destination controller in the above example?

thanks for response
 
I'm assuming both methods listed are in the same view controller. Is that true? If true then from reading the docs, you should still be using prepareForSegue:sender:. Does that not work?

P.S. I haven't played with seques yet. You question just looked interesting. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.