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?

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top