开发者

text disappear when setting image to navBar

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜