iphone navigationController autoloading to three level

别说谁变了你拦得住时间么 提交于 2019-12-01 14:58:09

Instead of calling pushViewController in the viewDidLoad methods, try setting the viewControllers array in the applicationDidFinishLaunching method:

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    RootViewController *root = [[RootViewController alloc] init];
    root.title = @"root";
    Second *second = [[Second alloc] init];
    second.title = @"second";
    Three *three = [[Three alloc] init];
    three.title = @"three";
    [navigationController setViewControllers:[NSArray arrayWithObjects:root,second,three,nil] animated:YES];
    [root release];
    [second release];
    [three release];

    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!