【发布时间】:2015-07-11 09:03:31
【问题描述】:
我以编程方式创建了 tabBarController,我想更改该选项卡包含的图像(而不是条形图)的色调颜色。谁能告诉我如何在 Swift 中做到这一点?
【问题讨论】:
标签: ios swift uiimage uitabbarcontroller tintcolor
我以编程方式创建了 tabBarController,我想更改该选项卡包含的图像(而不是条形图)的色调颜色。谁能告诉我如何在 Swift 中做到这一点?
【问题讨论】:
标签: ios swift uiimage uitabbarcontroller tintcolor
转到 AppDelegate.swift 文件。在“应用程序:didFinishLaunchingWithOptions”中写:
UITabBar.appearance().unselectedItemTintColor = UIColor.red
【讨论】:
在您的“应用程序:didFinishLaunchingWithOptions”中
(window?.rootViewController as! UITabBarController).tabBar.tintColor = UIColor.red
或使用外观委托。
UITabBar.appearance().tintColor = UIColor.red
【讨论】: