UINavigationController: Simplest Example

后端 未结 2 1008
天命终不由人
天命终不由人 2020-12-09 22:32

I\'m trying to do very simple example of a UINavigationController. Here is my code:

- (void)viewDidLoad {
  [super viewDidLoad];

This next

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 23:19

    - (void)viewDidLoad {
        [super viewDidLoad];
    
        PageOneController *one = [[[PageOneController alloc]init] autorelease];
        one.title = @"blah";
        navController = [[UINavigationController alloc] initWithRootViewController:one];
        [self.view addSubview:navController.view];
    }
    

    The basic idea behind it is that a navigation controller's root view controller is the controller which view will be displayed first in the navigation controller hierarchy. The root controller is not the view controller that you plug the navigation controller into. Hope this helps.

提交回复
热议问题