Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top