简体   繁体   中英

iOS - How to change color of icons in tab bar moreViewController

I want to change color of icons (and probably badge) in moreNavigationController from gray to something else.

I've read and successfully changed color of background and text. I did this by "replacing" data source of moreViewController (described eg here Customizing the More menu on a Tab bar ). But updating icons (also textLabel value) here makes no effect. Is it possible to change this gray color to white (or anything else)? Or I have to implement my own tabBarController ? (any good tutorials?)

PS. I know how to change icons on tab bar itself, the question is how to do this in moreViewController ?

Thanks! Piotr

In case it is still relevant to anyone. You can change icon colors displayed in a tableView of moreViewController:

self.tabBarController?.moreNavigationController.topViewController?.view.tintColor = UIColor.redColor()

Changing a title is like so:

self.tabBarController?.moreNavigationController.navigationBar.topItem?.title = "MyString"

Changing Edit button:

self.tabBarController?.moreNavigationController.navigationBar.tintColor = UIColor.redColor()

You can do this using the appearance proxy, new in iOS 5. In your app delegate's didFinishLaunching method:

[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
In iOS 7 use:

[[UITabBar appearance] setTintColor:[UIColor redColor]];

See the UITabBar class reference for more details.

Ok, from long research on the web and answers in this thread, it seems that it is not possible on iOS7 to change color of the icons (gray color) displayed in moreViewController of UITabBarController . The best solution for customizable tab bar is to implement it (or use some library).

Thanks!

You can change the color, just subclass the tab bar controller and in it's view did load add the below code

  override func viewDidLoad() {
    super.viewDidLoad()
    var view = self.moreNavigationController.topViewController.view as UITableView
    view.tintColor = Utilities.mainColor()
    view.separatorStyle = .None
  }

For more you can see my question here : Change tint color of tabbar edit view controller

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM