今天偶然間一個朋友問我如何修改UIImagePickerController
的tintcolor
痕慢,我所以然的告訴他,那還不簡單嗎,就把平時修改controller
的方法告訴了他:
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
然而他告訴我說這個方法不行,于是乎我自己試了一下發(fā)現(xiàn)果然不行,后來發(fā)現(xiàn)原來UIImagePickerController
是繼承navgationcontroller
,這樣就導(dǎo)致大家熟悉的方法不能使用,如果想要修改的話需要這樣來做:
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
if ([controller.navigationBar respondsToSelector:@selector(setBarTintColor:)]) {
[controller.navigationBar setTintColor:[UIColor redColor]];
[controller.navigationBar setTranslucent:NO];
}
這樣就OK啦伯铣!