This might be a very simple question but didn\'t yield any results when searching for it so here it is...
I am trying to work out a way to check if a certain view co
You can override the -(BOOL)shouldPerformSegueWithIdentifier:sender: method and do your logic there.
- (BOOL) shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([identifier isEqualToString:@"someSegue"]) {
if (!canIPerformSegue) {
return NO;
}
}
return YES;
}
Hope this helps.
There is no way to check that using the standard functions, what you can do is subclass UIStoryboardSegue
and store the information in the source
view controller (which is passed to the constructor). In interface builder select "Custom" as the segue type as type the class name of your segue, then your constructor will be called for every segue instantiated and you can query the stored data if it exists.
You must also override the perform
method to call [source presentModalViewController:destination animated:YES]
or [source pushViewController:destination animated:YES]
depending on what transition type you want.