我想知道是否可以仅更改 UINavigationBar 提示的背景颜色(例如,更改为红色,而导航栏的其余部分保持黑色),以便我可以使用 UINavigationItem 的提示属性来显示状态/错误消息作为单行。
这是一个老问题,但自从引入appearance
有一种比添加子视图更简单的方法来设置提示颜色(和其他属性)。
in didFinishLaunchingWithOptions
put
[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor theColorYouWantYourPromptToBe], UITextAttributeTextColor, otherVariables, nil]];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)