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
Post a Comment