开发者

iPhone: Possible to change the color of just the prompt of the UINavigationBar?

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.


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]];


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜