iOS Launch Storyboard:如何更改Tab Bar的色调颜色? [英] iOS Launch Storyboard: How can I change a Tab Bar's tint color?
问题描述
使用发布故事板。它非常简单,并包含一个默认的UITabBarController。我在发布故事板和我的应用程序中将标签栏的'tintColor'设置为红色。我正在使用Xcode 7,iOS 9。
Using a 'launch storyboard'. It's quite simple, and contains a default UITabBarController. I've set the tab bar's 'tintColor' to red in the launch storyboard, as well as in my app. I'm using Xcode 7, iOS 9.
启动屏幕加载标签栏使用默认的蓝色iOS色调颜色......!然后在加载后,当更换启动屏幕故事板时,色调颜色会变为红色。
The launch screen loads the tab bar using the default blue iOS tint color...! Then after loading, the tint color switches to red when the launch screen storyboard is replaced.
地球怎么样你打算在故事板中设置标签栏的色调吗?
演示项目: http://s000.tinyupload.com/?file_id=73998115878034693063
推荐答案
正确的方法是混淆Xcode。 Xcode不应该知道使用的启动故事板实际上是启动
故事板。这样您就可以设置一些自定义的用户定义的运行时属性
。但是,您仍然无法运行某些自定义代码...
The right way to go is to confuse Xcode. Xcode should not know that the launch storyboard that is used is actually a launch
storyboard. This way you would be able to set some custom User Defined Runtime Attributes
. However, you still would NOT be able to run some custom code...
所以......为此,请按照以下步骤操作:
So... To do this, follow these steps:
-
创建新的Xcode项目
Create a new Xcode project
复制 Main .storyboard
进入桌面并将其重命名为 CustomLaunchScreen.storyboard
。
Copy your Main.storyboard
into desktop and rename it to CustomLaunchScreen.storyboard
.
将 CustomLaunchScreen.storyboard
添加到项目中。
打开信息。 plist文件
并更改密钥启动屏幕界面文件基本名称
从 LaunchScreen
到<$的值c $ c> CustomLaunchScreen 。
打开 CustomLaunchScreen.storyboard
。删除默认的 UIViewController
并将 UITabBarController
设置为初始视图控制器
。
Open your CustomLaunchScreen.storyboard
. Delete the default UIViewController
and set the UITabBarController
as your initial view controller
.
打开 UITabBarController的
并导航至 tabBar
属性用户定义的运行时属性
添加 tintColor
属性,设置键入
为颜色
并设置一些自定义值。
Add the tintColor
property, set type
as Color
and set some custom value.
您还可以观看完整的视频教程这里
You can also watch a full video tutorial Here
这篇关于iOS Launch Storyboard:如何更改Tab Bar的色调颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!