0

I have a problem with the Storyboard in xCode 4.2. Is it posible to check, if a boolean is true to load the next view or if it is false to do not load the new view an stay in the actual view.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"toCategory"] && ([[codeField text] isEqualToString:@"1234"]))
        {                 
                QuestInfoController  *qicontroller = [segue destinationViewController];
        }
    else 
        {
        [super prepareForSegue:segue sender:self];
        return;

        }
}
Lailo
  • 641
  • 1
  • 8
  • 24

1 Answers1

1

Yes, but you don't do it quite like this. You'd use a custom method or check for your boolean value - then you'd use performSegueWithIdentifier: to force the transition based on the outcome.

I wrote another post about it here. It demonstrates how to wire a few buttons on a page to push the next view. Note that in the buttonPressed: method would be where you do your check.

Community
  • 1
  • 1
Simon
  • 8,981
  • 2
  • 26
  • 32