简体   繁体   English

如何在Xcode 4.2上推送NavigationController?

[英]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.

相关问题 iOS Swift 4-如何在NavigationController中推送UISearchController - iOS Swift 4 - How to push UISearchController in a NavigationController 如何在UIViewController上不使用NavigationController的情况下推送DetailView - How to push DetailView without NavigationController on UIViewController 如何在没有NavigationController的情况下推送子ViewController? - How to push sub-ViewControllers without NavigationController? 如何将值从NavigationController推送到rootViewController? - How to push values to the rootViewController from NavigationController? 如何从 NavigationController 中的 SwiftUI 视图推送到 UIViewController - How to push to UIViewController from SwiftUI View that is in NavigationController 如何使用推送Storyboard Segue为NavigationController - How to use push Storyboard Segue for the NavigationController 尝试从UIWebView用Xcode 4.2 iOS 5推送到详细视图 - Trying to push to detail view with Xcode 4.2 iOS 5 from UIWebView 使用Xcode 4.2从navcontroller中删除视图,然后推送新视图? - With Xcode 4.2 remove a view from navcontroller then push a new view? 使用if语句将tableViewController推送到navigationController中 - push tableViewController in a navigationController with if statement 如何将新的UICollectionViewController推送到cell的cell内的navigationController - How to push a new UICollectionViewController to the navigationController inside a cell of cells of cells
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM