[英]How to push NavigationController on Xcode 4.2?
With Xcode 4.1, I used to push a Navigation Controller using the following code: 使用Xcode 4.1,我曾使用以下代码推送导航控制器:
-(IBAction)goClasse1:(id)sender{
Classe1Chamada *goCL1 = [[Classe1Chamada alloc] initWithNibName:@"Classe1Chamada" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:goCL1 animated:YES];
[goCL1];
}
But now I updated to Xcode 4.2, this code just doesn't work. 但是现在我更新到Xcode 4.2,这段代码不起作用。 Why?
为什么? How can I fix it?
我该如何解决?
I always use it like this: 我总是像这样使用它:
-(IBAction)goClasse1:(id)sender{
Classe1Chamada *goCL1 = [[Classe1Chamada alloc] initWithNibName:@"Classe1Chamada" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:goCL1 animated:YES];
[goCL1 release];
}
and you don't need to initialize or delegate navigation controller in all your view controllers: it is already initialized in ViewController class. 并且您不需要在所有视图控制器中初始化或委派导航控制器:它已在ViewController类中初始化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.