0
我正在开发基于故事板的应用程序,使用XCode 4.2。我是新来的故事板,在此之前我使用这样创建一个类的新实例切换视图:无法使用故事板以编程方式切换视图?
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
}
故事板,这里就是我试图代码:
if (x==1)
{
[self performSegueWithIdentifier: @"theNewView" sender: self];
}
然后:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"theNewView"])
{
[[segue destinationViewController] setText:theText];
[reader presentModalViewController:[segue destinationViewController] animated:YES];
}
}
我确信,这些链接制作精良,而且prepareforsegue
方法被调用,但即使有这样的代码,新的观点并没有被加载?