在我的 AppDelegate 实现文件中,我使用这些代码行来设置 tabBarItems 的自定义字体和颜色:
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor grayColor], UITextAttributeTextColor,
[UIFont fontWithName:@"Arial" size:0.0], UITextAttributeFont,
nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:@"Arial" size:0.0], UITextAttributeFont,
nil] forState:UIControlStateHighlighted];
由于某些(未知)原因,会记录以下消息,每个 tabBarItem 一个:
button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted and UIControlStateDisabled. state = 1 is interpreted as UIControlStateHighlighted.
使用标准搜索引擎找不到任何东西,所以我寻求您的帮助。我做错了什么以及如何解决这个问题?
提前感谢您的任何建议。