2

我想知道是否可以仅更改 UINavigationBar 提示的背景颜色(例如变为红色,而导航栏的其余部分保持黑色),因此我可以使用 UINavigationItem 的提示属性来显示状态/错误消息作为单线。

4

2 回答 2

4

这是一个老问题,但由于引入了appearance比添加子视图更简单的方法来设置提示颜色(和其他属性)。

didFinishLaunchingWithOptions总而言之_

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor theColorYouWantYourPromptToBe], UITextAttributeTextColor, otherVariables, nil]];
于 2012-03-27T23:10:05.513 回答
2

没有。但是您可以将提示设置为空字符串,并在其顶部放置一个红色标签。

于 2010-01-08T19:49:15.360 回答