Xcode7 Swift-iPad App NavigationItem标题未显示 [英] Xcode7 Swift - iPad App NavigationItem title not showing
问题描述
我正在使用最新的XCode 7 Beta,并使用Swift编程语言创建一个简单的iPad应用程序.
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:
- 我从一个单一视图的应用程序模板开始
- 然后我将视图嵌入到NavigationController中
- 然后我创建了登录"视图UI元素
- 然后我将TabBarViewController放到情节提要上
- 然后我将登录"按钮链接到TabBarController
- 然后在标签栏的每个视图中,添加了NavigationBarItem并设置了标题
当应用程序运行并单击登录按钮时,我被带到TabBarController,但看不到标题.
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):
任何想法为何?我使用控件的方式有误吗?还是这是Xcode 7 Beta中的错误?
Any ideas why? Am I using the controls incorrectly? Or is this a bug in Xcode 7 Beta?
这是我的测试项目压缩文件: http://s000.tinyupload.com/index .php?file_id = 90125200274831974206
Here's my test project zipped: http://s000.tinyupload.com/index.php?file_id=90125200274831974206
推荐答案
即使在较早的Xcode版本中也存在此问题.我在后续步骤中解决了此问题:
This issue exists even in older Xcode versions. I resolved this issue in next steps:
- 为
Sales
和Customers
创建自定义类
- 在
viewWillAppear()
方法中为每个自定义类添加self.tabBarController!.title = "Sales or Customers"
.
- Create custom class for
Sales
andCustomers
- Add
self.tabBarController!.title = "Sales or Customers"
inviewWillAppear()
method for each custom class.
这篇关于Xcode7 Swift-iPad App NavigationItem标题未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!