【发布时间】:2018-08-23 12:43:57
【问题描述】:
我的应用结构:
firstView: UIViewController 和 UINavigationController -- secondView UITabBarController 和几个UIViewControllers
启动应用,firstView:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let vc = ViewController()
let navContr = UINavigationController(rootViewController: vc)
self.window? = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = navContr
self.window?.makeKeyAndVisible()
return true
}
在 firtView 我点击按钮打开 secondView:
let vc = MyTabController() // my UITabBarController
self.navigationController?.pushViewController(vc, animated: true)
启动第二个视图:
class MyTabController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let gen = MyViewController()
let tabGen = UITabBarItem()
gen.tabBarItem = tabGen
tabGen.image = UIImage(named: "general")
tabGen.title = "Все вопросы"
viewControllers = [gen]
....
}
在我的secondView 中,我想设置标题,在每个标签中设置UISearchControlleer。但是如果我写ViewController
navigationItem.title = "myTitle" 没有任何变化。我只看到按钮“返回”。
【问题讨论】:
标签: ios swift uinavigationcontroller uitabbarcontroller