Changing tab bar item image and text color iOS

前端 未结 22 1107
说谎
说谎 2020-12-02 06:10

Here is my tab bar:

\"enter

The following image shows the program being run an

22条回答
  •  遥遥无期
    2020-12-02 06:59

    Try add it on AppDelegate.swift (inside application method):

    UITabBar.appearance().tintColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0)
    
    // For WHITE color: 
    UITabBar.appearance().tintColor = UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 1.0)
    

    Example:

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Tab bar icon selected color
        UITabBar.appearance().tintColor = UIColor(red: 0/255.0, green: 0/255.0, blue: 0/255.0, alpha: 1.0)
        // For WHITE color: UITabBar.appearance().tintColor = UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 1.0)
        return true
    }
    

    Example:

    My english is so bad! I'm sorry! :-)

提交回复
热议问题