简体   繁体   中英

Change UITabBar while running

I'm making a theme for my app, and when I switch themes, the UITabBar doesn't want to apply coloration.

The bar only take the color defined in the active theme at launching. I'm calling this but it doesn't work :/

    [[UITabBar appearance] setBarStyle:[theme tabBarStyle]];

Appearance proxy has no effect on existing views - only on future views. That is why it is usually called only at launch time, before there is any interface at all.

You are free to set the appearance proxy at any time, but if you want existing views to change their appearance you must do that in the normal way, ie by sending a message directly to those existing views. You'll have organize your code in such a way as to make that possible.

Alternatively, of course, you can set the appearance proxy, destroy your entire existing interface, and then rebuild your interface under the influence of the new proxy settings.

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