开发者

UIImagePicker's UINavigationBar is abiding to drawRect. How can I stop this?

开发者 https://www.devze.com 2023-03-08 20:50 出处:网络
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 o

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消