【发布时间】:2016-06-08 16:27:04
【问题描述】:
注意:我尝试在任何可能的地方将 hidesBottomBarWhenPushed 设置为 false...
这是我在 AppDelegate 文件中初始化 UITabBarController 的方式:
func initTabBarController()
{
let myVC1 = MapVC()
let myVC2 = MapVC()
let myVC3 = MapVC()
let myVC4 = MapVC()
let controllers = [myVC1,myVC2,myVC3,myVC4]
self.myTabBarController = UITabBarController()
self.myTabBarController.viewControllers = controllers
myVC1.tabBarItem = UITabBarItem(
title: "Map",
image: image1,
selectedImage: image11)
myVC2.tabBarItem = UITabBarItem(
title: "Map",
image: image2,
selectedImage: image21)
myVC3.tabBarItem = UITabBarItem(
title: "Map",
image: image3,
selectedImage: image31)
myVC4.tabBarItem = UITabBarItem(
title: "Menu",
image: image4,
selectedImage: image41)
self.tabNavigationController = UINavigationController(rootViewController: self.myTabBarController)
self.tabNavigationController.navigationBar.translucent = false
}
下面是我设置主窗口的 rootViewController 的方法:
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.initTabBarController()
appDelegate.window!.rootViewController =
appDelegate.tabNavigationController
appDelegate.window!.makeKeyAndVisible()
最后,我尝试在我的一个 ViewController (MapVC) 中推送一个新的视图控制器:
let v = UIViewController()
v.view.backgroundColor = UIColor.yellowColor()
self.tabBarController?.navigationController?.pushViewController(v, animated: true)
执行此代码时,黄色视图显示良好,但底部标签栏隐藏。
我还想保留我的标签栏!!!
我尝试将属性 hidesBottomBarWhenPushed 设置为 false 到任何我可以设置的对象,但未成功。
请帮帮我!!!
问候, 阿尔克斯
【问题讨论】:
标签: ios