快速更改NavigationControl和TabBar的颜色

Mat*_*oAB 2 tabbar uitabbarcontroller uinavigationcontroller swift

我想改变所有应用程序的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)
Run Code Online (Sandbox Code Playgroud)

还有这个

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()
Run Code Online (Sandbox Code Playgroud)

但是我有超过5个标签,所以我有"更多"按钮,当我按下它时,图标不是红色而是蓝色,当我按下编辑标签栏图标时,标签的名称是红色,但图标不是.我能做什么?图片解释:http: //postimg.org/image/67oqa15ll/

小智 7

要在整个应用程序中更改所有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

}
Run Code Online (Sandbox Code Playgroud)

那就行了!