ios - How can I change the color of the UINavigationBar&UIToolbar dynamically/immediately/on-demand? -
i'm looking change colors of things uinavigationbar, uitabbar, etc.
i have section in application called "my themes". user, when logged in, can go section , select 1 of various color themes such "night theme", color many of view's in dark shades.
when first launch application, call piece of code...
[[colormanager sharedmanager] updateapplicationcolors];
this method, updateapplicationcolors
, pull in custom theme object nsuserdefaults, pulling in last theme object being used. object holds colors various things navigationbar, toolbar, tabbar, etc.
then after pulling in, in proceeds use theme object's colors set various view's appearance proxy's.
such as...
... [[uitabbar appearance] setbartintcolor:tabbarbartintcolor]; [[uitabbar appearance] settintcolor:tabbartextcolor]; [[uinavigationbar appearance] setbartintcolor:navigationbartintcolor]; [[uinavigationbar appearance] settintcolor:navigationtintcolor]; [[uitoolbar appearance] setbartintcolor:toolbarbartintcolor]; [[uitoolbar appearance] settintcolor:toolbartintcolor]; ...
now, things happen immediately, such [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelight______];
. however, rest not take effect right away.
the navigationbar's color don't changed until pop 'my themes' view off navcontroller stack, , change tab in tabbar i'm on. switch, navigationbar color change takes effect.
however, toolbar color doesn't change under same circumstances. can kill app multitasking, , open again, , see new color in effect. other way can color change after selecting theme, present mfmailcomposeviewcontroller. if press cancel, tabbar have new color.
how can these color changes take effect after user presses theme in "my themes" view?
Comments
Post a Comment