UICabBarItem外观为UIControlStateHighlighted

时间:2013-07-29 17:15:01

标签: ios uitabbaritem

我在didFinishLaunchingWithOptions:下的AppDelegate.m文件中有此代码,因此我可以使用自定义字体。

[[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                        [UIColor grayColor], UITextAttributeTextColor,
                                                        [UIFont fontWithName:@"Gotham-Medium" size:10], UITextAttributeFont, nil] forState:UIControlStateNormal];

[[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                        [UIColor whiteColor], UITextAttributeTextColor,
                                                        [UIFont fontWithName:@"Gotham-Medium" size:10], UITextAttributeFont, nil] forState:UIControlStateHighlighted];

字体更改按预期工作,但我在调试控制台中获得此输出:

button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted and UIControlStateDisabled. state = 1 is interpreted as UIControlStateHighlighted.

1 个答案:

答案 0 :(得分:5)

UIControlStateHighlighted更改为UIControlStateSelected