我想知道我是否可以改变UINavigationBar提示的背景颜色(例如红色,而导航栏的其余部分保持黑色),所以我可以使用UINavigationItem的prompt属性来显示状态/错误消息作为单线 .
不 . 但您可以将提示设置为空字符串,并在其上放置一个红色标签 .
这是一个老问题,但自从引入 appearance 以来,设置提示颜色(和其他属性)比添加子视图更容易 .
appearance
在 didFinishLaunchingWithOptions 放
didFinishLaunchingWithOptions
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor theColorYouWantYourPromptToBe], UITextAttributeTextColor, otherVariables, nil]];
2 回答
不 . 但您可以将提示设置为空字符串,并在其上放置一个红色标签 .
这是一个老问题,但自从引入
appearance
以来,设置提示颜色(和其他属性)比添加子视图更容易 .在
didFinishLaunchingWithOptions
放