UIControlStateHighlighted

UIControlStateHighlighted

在我的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.

使用标准搜索引擎找不到任何内容,因此,我寻求您的帮助。我在做什么错以及如何解决这个问题?

预先感谢您的任何建议。

最佳答案

只需将“UIControlStateHighlighted”更改为“UIControlStateSelected”即可。希望这可以帮助!

关于iphone - UITabBarItem外观-setTitleTextAttributes会继续记录 “state = 1 is interpreted as UIControlStateHighlighted”吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10971705/

10-10 21:07