I'm trying to set a custom color for a button on my UINavigationBar, but only when a particular UIViewController is being displayed in it (I know this is dubious UI design, but it's a specific customer requirement).
Our current implementation uses a Swizzle to override drawRect
for all UINavigationBar
objects. This is necessary so our custom navigation bar colors are applied to standard iOS screens (like when adding a new contact through standard APIs).
I want to change the tint color of the navigation bar for one particular UIViewController to be different from the others, but the Swizzle always takes precedence.
I'm testing in the iOS 4.3 Simulator. We support iOS 3.x clients and above (iPhone, iPod and iPad), so I can't just use the newer iOS 5 APIs to customize it.
Other things I've tried, without success:
Adding
setStyle
calls (as per this workaround) to make the button update again.I tried the
UINavigationButton
hack I found here (I know this is a private API and risks Apple rejecting the app). I tried putting that code inviewWillAppear
as well.