我想更改所有应用程序的 NavigationControl 的后退按钮的颜色,我该怎么做?我想让它变成红色而不是普通的蓝色按钮...
我的 TabBar 有问题。 我已经将图标颜色和名称从标准蓝色更改为红色:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.redColor()], forState:.Selected)
还有这个
class TabBarController: UITabBarController {
var color = UIColor.redColor()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.tabBarController?.tabBar.selectedImageTintColor = UIColor.redColor()
UITabBar.appearance().selectedImageTintColor = UIColor.redColor()
但我有 5 个以上的标签,所以我有“更多”按钮,当我按下它时,图标不是红色而是蓝色,当我按下编辑标签栏图标时,名称选项卡是红色的,但图标不是。 我能做些什么? 图片说明: http://postimg.org/image/67oqa15ll/
最佳答案
更改整个应用程序中所有 UITabBarItem 的文本和图标的颜色(在 Swift/Xcode 6 中):
在 AppDelegate.swift 中:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: your_color ], forState: .Selected)
UITabBar.appearance().tintColor = your_color
return true
}
这样就可以了!
关于快速更改 NavigationControl 和 TabBar 的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27082005/