You should not set like that , if you are considering iOS 4.0 also
use this
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"bgTopBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
or for iOS 5
use this, no need to give frame to it, and you cant change the height more than 44, the default height of navigation bar is 44
UINavigationBar *navBar = self.navigationController.navigationBar;
UIImage *image = [UIImage imageNamed:@"bgTopBar.png"];
[navBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
No comments:
Post a Comment