简体   繁体   中英

Adding a navigation bar to tab view

Most of the tutorials that I came across are just showing a Navigation Controller and then a tableview controller, this works fine IF i am using only the tableview controller, but in mycase I am already using TabBar Controller and now I want to have a bar on top of the viewcontrollers , DOESN'T necessarily have to have a back button. But something that merges with the topbar (time, battery and carrier), right now I have this 在此处输入图片说明

but when I run I get is this 在此处输入图片说明

在此处输入图片说明

how can I fix this, do take note I am quite new and trying my best.

EDIT 1: Followed the comments advise, happy now, but no title. :(

在此处输入图片说明

Instead of wrapping your UITabBarController in a navigation controller, wrap every view controller inside a navigation controller and then add them (navigation controllers) to tab controller.

Few tips:

  • self.tabBarController inside wrapped child UIViewControllers will give you the tab reference.
  • When you want to hide bottom bar when pushing next UIViewController, do nextViewController.hidesBottomBarWhenPushed = YES; and then push it on the self.navigationController will hide the bottom tab bar, handy when required.
  • You can use UITabBar and UITabBarItem appearance methods to customize the look of your tab bar from one place in the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM