ios - Back Button does not color accordingly (objective c) -
i’m working on iphone/ipad app has multiple navigation bar colours. in 1 part of app navigation bar has orange , in other part has purple. on start screen of app navigation bar hidden.
the colour of navigation bar, button , bar button set in prepareforsegue according segue identifier both sections of app.
uiimage *navbackgroundimage = [uiimage imagenamed:@"navigation-bar-orange.png"]; [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; //change appearance of button uiimage *backbuttonimage = [[uiimage imagenamed:@"back-orange"] resizableimagewithcapinsets:uiedgeinsetsmake(0, 13, 0, 6)]; [[uibarbuttonitem appearance] setbackbuttonbackgroundimage:backbuttonimage forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; //change appearance of standard navigation button uiimage *barbuttonimage = [[uiimage imagenamed:@"standard-orange"] resizableimagewithcapinsets:uiedgeinsetsmake(0, 6, 0, 6)]; [[uibarbuttonitem appearance] setbackgroundimage:barbuttonimage forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; [[uinavigationbar appearance] settitletextattributes: [nsdictionary dictionarywithobjectsandkeys: [uicolor colorwithred:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], uitextattributetextcolor, [uicolor colorwithred:0.0 green:0.0 blue:0.0 alpha:0.8],uitextattributetextshadowcolor, [nsvalue valuewithuioffset:uioffsetmake(0, 1)], uitextattributetextshadowoffset, [uifont fontwithname:@"futura-condensedmedium" size:21.0], uitextattributefont, nil]];
when switching other part of application (going through segue again), navigation bar , standard bar button coloured correctly, button have colour of previous part of app. i’ve tried setting colour on several occasions in application (e.g. viewwillappear , viewdidload), problem still occurs.
how can fix problem , show correct button colour both sections of application? there maybe (better) way set different navigation bar colours?
visual example of occuring problem:
you correct. in fact, text set button in code behave similarly. button displayed gets settings previous view controller. shift settings one.
Comments
Post a Comment