UIImagePicker's UINavigationBar is abiding to drawRect. How can I stop this?
I am using the following code to set the backgrounds of all UINavigationBars in my application. However, when I load the UIImagePicker, its' UINavigationBar will have the same backgroundView as all of the other UINavigationBars in my application.
How开发者_如何学运维 could I prevent this from happening?
@implementation UINavigationBar (UINavigationBarCategory)
- (void) drawRect:(CGRect)rect {
[[UIImage imageNamed:@"NavBarSocial.png"] drawInRect:rect];
}
@end
I had the same problem and i fixed it by using the following code in my drawRect method
UIColor *color = [UIColor blackColor];
UIImage *img = [UIImage imageNamed: @"NavigationBarBackground.png"];
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = color;
精彩评论