iphone navigationController autoloading to three level

后端 未结 1 1813
遇见更好的自我
遇见更好的自我 2021-01-17 02:30

i create i navigationController project name:autoload, then create two uiviewContorller named: second,three

i want the process is load rootView the load second in

相关标签:
1条回答
  • 2021-01-17 02:56

    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];
    }
    
    0 讨论(0)
提交回复
热议问题