开发者

navigation controller doesn't show up iphone

开发者 https://www.devze.com 2023-03-09 12:11 出处:网络
I have an application with a tab bar as the root controller. I have four items in the tabbar. The second item is a table view and this should have a navigation controller of course, the thing is that

I have an application with a tab bar as the root controller. I have four items in the tabbar. The second item is a table view and this should have a navigation controller of course, the thing is that i don't even get the navigation bar to show up and i have no idea how to do it. So i tried to guess after a long time in google without success. This is what i did in the viewDidLo开发者_运维知识库ad method:

SearchNavController *navController = [[SearchNavController alloc]init];

    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:navController];

    [searchNavController release];

With that i got an IlegalArgumentException. How can i get the navigation bar to show up?

Thanks in advance guys

Have a nice day!


Since you used interface builder to setup your tabbarcontroller. follow the following steps to get navigation bar and navigation controller in your tabbarcontroller:

Open Mainwindow.xib and select tababarcontroller . In the attribute inspector , select the item1 in viewcontroller and from the arrows to the right change it to navigation controller.

Try this link:
link 1


Your navController should probably an ordinary UIViewController with the view you want to display. Also you need the following to actually display the navigationController:

[self presentModalViewController:navigationController animated:YES];

The navigation controller should now show up with your view as it's content.


IF you are using interface builder. Then Add UINavigation controller in each tab bar then add your view controller in uinavigation conrtroller. If you have 4 tabs then you have to put 4 navigation controller.

UITabbarcontroller ->>Tab Bar >> UINavigationController >> set its class to your viewcontroller

0

精彩评论

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