我UIPickerView
在 的子类中有一个视图UINavigationController
。我有一个UIAppearance
代理,我想将其应用于UINavigationController
子类中包含的许多视图,但我不希望UIAppearance
在UIPickerView
.
有没有办法让UIAppearance
代理应用于UINavigationController
子类内的所有视图,然后保护特定对象内的视图免受其影响?
如果没有 UIAppearance,屏幕如下所示:
使用此代码:
#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;
}
屏幕如下所示:
我不希望 UIPickerview 的子视图被青色破坏,尽管我可能想将青色应用于 UINavigationController 中包含的许多其他视图。