using image or tint color on uinavigationbar in iphone?

前端 未结 7 1752
自闭症患者
自闭症患者 2020-12-24 09:58

how do i show a background image on a navigation bar or give tint color to the navigation bar in a native iphone application??

相关标签:
7条回答
  • 2020-12-24 10:47

    For iOS5 use the following lines of code:

    UINavigationBar *navBar = [[self navigationController] navigationBar];
    UIImage *backgroundImage = [UIImage imageNamed:@"nav-bar-background-normal"];
    [navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
    

    For backward compatibility do a check to see if the navigation bar responds to setBackgroundImage:forBarMetrics:

    More information on: http://sebastiancelis.com/2009/12/21/adding-background-image-uinavigationbar/

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