i know that this question looks the same as other around here, but none of them say anything about incompatibility between ios4 and ios5.
In my app i want to customize the pattern of the navigation Bar, but my deployment target is ios4, so i am using the code bellow above the implementation of the appDelegate.m to do this:
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor blackColor];
UIImage *image = [UIImage imageNamed: @"nav_bar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = color;
}
@end
When i run the app using the 4.3 simulator, it works properly, but when i simulate in ios5, it doesnt work, the nav bar goes back to the default color.. any help?
Thanks.
I'd recommend using your existing code when running on iOS4, and using the new iOS5 features to customize the bar under iOS5.
See here: UINavigationBar's drawRect is not called in iOS 5.0