开发者

Adding a UITabBarController to an UIViewController

I've got a sample application on http://github.com/niklassaers/Test-iPhone-TabBar-App that shows my problem: I have a regular view-based application, and at some point (in this case when I click a button) I want to load a tabbar controller and display it. I believe this is what I should be doing:

MyTabBarController *tabs = [[MyTabBarController alloc] initWithNibName:@"TabBar" bundle:nil];
[self.view addSubview:tabs.view];

Unfortunately, this brings up a bit of black in the bottom of my main view and nothing more. I believed it should bring up the tabbar, the tabs, and the select开发者_运维百科ed view. What is the correct way of loading a TabBarController (or making a TabBar controller if that's what I've done wrong) in a view-based application?

Cheers

Nik


You should use a UINavigationController, then just push the tabs controller onto the nav controller when you're ready to display it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜