Question

I am developing a storyboard-based application, using XCode 4.2. I'm new to storyboards, before that I used to switch views by creating a new instance of a class like this:

if (x==1)
{    
    theClass *theView ;
    theView= [[theClass alloc] initWithNibName:nil bundle:nil];
    [theView setText:theText];
    [reader presentModalViewController:theClass animated:YES]; //where reader is an instance of the ZBar library
}

With storyboards, here is the code I am trying:

if (x==1)
{
    [self performSegueWithIdentifier: @"theNewView" sender: self];
}

then:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"theNewView"])
    {
        [[segue destinationViewController] setText:theText];
        [reader presentModalViewController:[segue destinationViewController] animated:YES];
    }
}

I made sure that the links are well made and that the prepareforsegue method is called, but even with this code, the new view is not being loaded?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top