Reputation: 9243
I think i must be missing something simple here but I can't figure out what is it.
I've got to support multiple segues from the same viewcontroller, so naturally i'd like to use the segue identifiers. My code is not working for some reason, let me give you an example:
This code as follows:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSString *segueID = @"createBuildSegue";
if (segue.identifier == @"createBuildSegue") {
UINavigationController *navController = segue.destinationViewController;
CreateBuildTableViewController *rootController = [navController.viewControllers objectAtIndex:0];
[rootController setOptionsDictionary:[[DataManager sharedDataManager]optionsDictionary]];
NSLog(@"Worked");
}
NSLog(@"segue identifier = %@", segue.identifier);
NSLog(@"segueID = %@", segueID);
}
here is the output from the console:
2012-06-17 22:32:06.921 RubiconMobile[26943:f803] segue identifier = createBuildSegue
2012-06-17 22:32:06.922 RubiconMobile[26943:f803] segueID = createBuildSegue
This does not work and I can not figure out why. realllly bugging me
any ideas?
Thanks!
Upvotes: 0
Views: 1406
Reputation: 119292
Compare strings using isEqualToString:
, not ==
. The latter checks for pointer equality, the former to see if the strings are in fact the same string.
if ([segue.identifier isEqualToString: @"createBuildSegue"])
Upvotes: 5