开发者

programmatically creating a UINavigationController

开发者 https://www.devze.com 2023-03-30 23:34 出处:网络
Initially I used the IB to drag a navcontroller onto my tabbar and then setting the root controller. However, I\'m trying to cr开发者_如何学运维eate a nav controller without IB.

Initially I used the IB to drag a navcontroller onto my tabbar and then setting the root controller. However, I'm trying to cr开发者_如何学运维eate a nav controller without IB.

What I've done is created a navcontroller subclass that will be used in my tabbar. The nav bar does show up so I know that is working.

Now, I need to push a viewcontroller into the hierarchy. In the nav controller's viewDidLoad:

- (void)viewDidLoad {

    InfoViewController *initialController = [[InfoViewController alloc] init];
    [self.navigationController pushViewController:initialController animated:YES];

    [initialController release];
    [super viewDidLoad];
}

I get no errors, but nothing shows up in the navigation controller. Anyone know why?


What does your InfoViewController's init method look like? If you're using a nib to build that, then you need to call initWithNib, not init.


Create the viewcontroller when/where you create the navigation controller (and add them to it) then add the list of view controllers to the tabbar.

0

精彩评论

暂无评论...
验证码 换一张
取 消