Xcode7 Swift - iPad App NavigationItem title not showing

巧了我就是萌 提交于 2019-12-25 04:09:07

问题


I am using the latest XCode 7 Beta and creating a simple iPad application using Swift programming language.

This is how I have setup my Storyboard:

  1. I started with a single view app template
  2. Then I embedded the view in a NavigationController
  3. I then created my "Login" view UI elements
  4. I then dropped a TabBarViewController onto the storyboard
  5. I then linked the "Login" button to the TabBarController
  6. Then within each view of the tabbar, I added a NavigationBarItem and set a title

When the app runs and I click the login button, I am taken to the TabBarController, but I do not see the title.

This is how my storyboard looks like:

The app runs like this (after I clicked the login button):

Any ideas why? Am I using the controls incorrectly? Or is this a bug in Xcode 7 Beta?

Here's my test project zipped: http://s000.tinyupload.com/index.php?file_id=90125200274831974206


回答1:


This issue exists even in older Xcode versions. I resolved this issue in next steps:

  1. Create custom class for Sales and Customers
  2. Add self.tabBarController!.title = "Sales or Customers" in viewWillAppear() method for each custom class.



回答2:


Please set title in view didload:

navigationItem.title = "title"


来源:https://stackoverflow.com/questions/32543873/xcode7-swift-ipad-app-navigationitem-title-not-showing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!