Domanda

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?

È stato utile?

Soluzione

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];
}];

Altri suggerimenti

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...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top