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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -