Custom UINavigation image disappears when app comes back from multi-tasking
I have a category to display a custom image in an app's UINavigationBar. When the app comes back from the background the image sometimes disappears and all I am left with is a white navigation bar with buttons.
The category I'm using is below, can anyone advise please?
@implementation UINavigationBar (CustomImage)
-(void)drawRect:(CGRect)rect {
cardSmartAppDelegate *delegate = (cardSmartAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.navImage drawInRect:开发者_运维技巧rect];
}
@end
You shouldn't use a category to override a method. Sometimes it works, but often it doesn't. Rumor has it that it will quit working altogether soon.
See my code in this item for how to do what you want:
Custom UINavigationBar Background
精彩评论