Once the app has launched, if I want to allow a user to change the tint color of the UITabBar (or NavigationController) how do I do that ?

Is there a refresh for a TabBar?

有帮助吗?

解决方案

I was able to create the effect that I as looking for by using this code:

    [UIView animateWithDuration:0.25 animations:^{
    [self.navigationController.navigationBar setBarTintColor:someColor];
}];

其他提示

It seems that the code that works in the AppDelegate (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method:

[[UITabBar appearance] setTintColor: tintColorOfImages];
[[UITabBar appearance] setBarTintColor: backgroundColorOfTabBar];

doesn't work after that. However, you can make it change from any ViewController by calling:

[[[self tabBarController] tabBar] setTintColor: tintColorOfImages];
[[[self tabBarController] tabBar] setBarTintColor: backgroundColorOfTabBar];

Perhaps, it's a bug...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top