objective c - Set Different UINavigatiobar color for different UIViewController in iOS? -


i have sample project 3 uiviewcontroller want change uinavigationbar color each viewcontroller.

i tried use code in viewdidappear method , not changing.

[self.navigationcontroller.navigationbar setbackgroundimage:[uiimage imagenamed: @"bg.png"]                                               forbarmetrics:uibarmetricsdefault]; 

in fact code setting background navigationbar, , true. if want set color each viewcontroller navigation bar, in viewcontroller1 (say first view controller) viewdidappear method add

[self.navigationcontroller.navigationbar setbartintcolor:[uicolor greencolor]]; 

in viewcontroller2 (say second view controller) viewdidappear method add

[self.navigationcontroller.navigationbar setbartintcolor:[uicolor bluecolor]]; 

then navigate through these controllers, see background color of navigation bar changed .

but problem may not setting viewcontroller custom class, can set identity inspector.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -