Reputation: 1816
i did segue with one property it works but the second property causes error "no known instance method for selector..."
how many variables one can initialize when segueing?
[segue.destinationViewController setID:1 setName:@"name"];
with either of the setters it works but no more than one. any idea why? and how to set more than property?
Upvotes: 1
Views: 531
Reputation: 18487
Override the prepareForSegue:sender:
method in the originating view controller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UIViewController *controller = segue.destinationViewController;
controller.ID = 1;
controller.name = @"name";
}
Upvotes: 2
Reputation: 750
You can create an instance of the destinationViewController and edit that.
UIViewController *nextController = [segue destinationViewControler];
[nextController setID:1];
[nextController setName:@"name"];
If you are working with a custom class you will need to do it slightly differently:
YourClass *nextController = (YourClass *)[segue destinationViewController];
[nextController setID:1];
[nextController setName:@"name"];
Sorry if there are any typos. I know this works because I have used it in multiple applications.
Upvotes: 2