UINavigationBar appearance not updating
UINavigationBar appearance not updating
- Subject: UINavigationBar appearance not updating
- From: Roland King <email@hidden>
- Date: Wed, 11 Apr 2012 22:24:45 +0800
I want to give a hint in my app whether you are or are not using iCloud. As most screens have a navigation bar, I thought that changing the tint color of that would be a nice visual effect, it's not bad, not sure I'm fine with it yet but working on it.
To do it I'm using the UIAppearance protocol, here's the method which does the work.
-(void)updateTintsForICloud
{
BOOL usingICloud = [ [ HIPSettings sharedSettings ] usingICloud ];
[ [ UINavigationBar appearance ] setTintColor:usingICloud ? [ UIColor colorWithRed:0 green:0 blue:.3 alpha:1.0f ] : [ UIColor clearColor ] ];
}
Not too complicated.
This runs on iPhone and iPad. On iPhone the screen which switches between iCloud and local is a full-screen modal popover. It covers over what is currently displayed on the screen (the navigation stack) and at the end it eventually calls updateTintsForICloud on exit. Works fine, when the nav stack re-shows on-screen the navigation bar has been updated to the new tint.
On iPad it's the same view, but it's presented as a modal formsheet, so the nav stack behind it dims but continues to display and the form sheet shows up as a box in the middle of the screen. The same logic follows, updateTintsForICloud is still called, the UINavigationBar appearance is changed but .. it doesn't actually update the on-screen nav bar, nor any subsequent navbar pushes.
My assumption is that the difference is with iPad the old navigation bar stays on-screen, albeit dimmed, and so doesn't re-draw and pick up the new defaults, with iPhone it is totally covered up and so gets a redraw when it uncovers.
Is there a method I've missed which tells UIAppearance to update currently visible elements, or do I have to write some code to update any currently showing nav bar with the current tint hint? I have perused the stuff about UIAppearance but it's quite thin and not totally helpful.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden