Add image to a navigationItem's title

后端 未结 3 1154
囚心锁ツ
囚心锁ツ 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:35

    Set UINavigationItem.titleView to a custom view (or just a straight UIImageView).

    0 讨论(0)
  • 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"]];   
    
    0 讨论(0)
  • 2021-02-14 15:54

    You can customize navigationItem.titleView, class of UIView

    0 讨论(0)
提交回复
热议问题