Add image to a navigationItem's title

后端 未结 3 1165
囚心锁ツ
囚心锁ツ 2021-02-14 15:28

I\'d like to add a logo to the left of my title on my navigation bar. The title property seems to only take an NSString. What\'s the best way to add an image to the navigation

3条回答
  •  佛祖请我去吃肉
    2021-02-14 15:43

    You can replace the title view with an image like this:

    navigationItem.titleView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"title_bar.png"]];   
    

提交回复
热议问题