ios - UITabBar custom background image applied in one view controller instead of in the AppDelegate -
i working themes in iphone app. have 2 tabs in tab bar (timeline , settings) , when user goes second tab (settings), selects themes in settings , selects theme, styles background image , navigation bar of first table view controller in first tab (timeline). works.
i want achieve same thing tab bar, tab bar changes along background image , navigation bar.
in timeline table view, put following code in viewwillappear:
uiimage *tabbackgroundimage = [uiimage imagenamed:@"purplepinktopp.png"]; [[uitabbar appearance] setbackgroundimage:tabbackgroundimage]; however, tab bar never changes. way change tab bar in appdelegate changes everywhere. need allow user select theme , changes accordingly , need change on per view controller basis, same way navigation bar.
in viewwillappear of timeline table view, set navigation bar with:
uiimage *navbackgroundimage = [uiimage imagenamed:@"purplepinknav.png"]; [[uinavigationbar appearance] setbackgroundimage:navbackgroundimage forbarmetrics:uibarmetricsdefault]; that works. doesn't work tab bar code above.
edit: i've added apperancewhencontainedin viewwillappear:
uiimage *tabbackgroundimage = [uiimage imagenamed:@"solidpurple.png"]; [[uitabbar appearance] setbackgroundimage:tabbackgroundimage]; [uitabbar appearancewhencontainedin:[uitabbar class], [uitabbar class], nil]; but doesn't seem doing anything.
how can go fixing this? assistance immensely appreciated.
there refinement uiappearance proxy call try...
+ (id)appearancewhencontainedin:(class <uiappearancecontainer>)containerclass,... this sets appearance uiappearance proxy compliant object supplied values when it's contained in specific view controller subclass.
Comments
Post a Comment