Im showing an image a nav bar, but the title has disappear, why?
how to fix it?
- (void)viewDidLoad { [super viewDidLoad];
UIImage *image = [UIImage imageNamed: @"navbar.png"];
UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
self.navigationItem.titleView=imageView;
[imageView r开发者_开发技巧elease];
// self.title = @"Bio";
self.navigationItem.title = @"Bio";
}
Thanks a lot!
You've replaced the title view with your image view, so the navigation bar can no longer display a title.
If you want text and an image, you'll need to add an image view with a UILabel
subview as the titleView, and set the text of the UILabel
.
精彩评论