Question

I'm wondering if I can change the background color of just the prompt of the UINavigationBar (e.g. to red, while the rest of the navigation bar stays black), so I can use the prompt property of the UINavigationItem to display status / error messages as a one-liner.

Was it helpful?

Solution

Nope. But you can set the prompt to an empty string, and place a red-colored label on top of it.

OTHER TIPS

This is an old question, but since the introduction of appearance there is a much easier way to setting prompt color (and other properties) than adding a subview.

in didFinishLaunchingWithOptions put

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor theColorYouWantYourPromptToBe], UITextAttributeTextColor, otherVariables, nil]];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top