iphone - Protect class from UIAppearance -
i have uipickerview
in view inside subclass of uinavigationcontroller
. have uiappearance
proxy want apply many views contained in uinavigationcontroller
subclass, don't want uiappearance
operate on uipickerview
.
is there way have uiappearance
proxy apply views inside uinavigationcontroller
subclass , protect views inside specific objects effect?
without uiappearance, screen looks this:
with code:
#import "appdelegate.h" @interface appdelegate() @property (nonatomic, strong) uinavigationcontroller *nvcmain ; @end @implementation appdelegate @synthesize window ; @synthesize nvcmain ; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] ; uistoryboard *sb = [uistoryboard storyboardwithname:@"main_ph" bundle:nil] ; nvcmain = [sb instantiateinitialviewcontroller] ; window.rootviewcontroller = nvcmain ; self.window.backgroundcolor = [uicolor whitecolor]; [self.window makekeyandvisible]; id apprnvcview = [uiview appearancewhencontainedin:[uinavigationcontroller class], nil] ; [apprnvcview setbackgroundcolor:[uicolor cyancolor] ]; return yes; }
the screen looks this:
i don't want subviews of uipickerview clobbered cyan, although may want apply cyan many other views contained in uinavigationcontroller.
i'm not sure trying accomplish, here happening code.
you setting views background color cyan inside navigation controller. uipickerview view so, it's color changed.
edit:
i think appearance protocol overkill want. want change color of view behind picker view, go ahead , set background color.
[[self your_view] setbackgroundcolor:[uicolor bluecolor]];
the appearance protocol works if want change of view particular color. example, want navigation bars red color, set in 1 spot, , change navigation bars in application.
for work, have subclass views want blue color, , set them appearance protocol method appearancewhencontainedin.
Comments
Post a Comment