UIControlStateHighlighted

UIControlStateHighlighted

我在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];

字体更改按预期工作,但我在Debug控制台中得到了以下输出:
button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted and UIControlStateDisabled. state = 1 is interpreted as UIControlStateHighlighted.

最佳答案

UIControlStateHighlighted更改为UIControlStateSelected

关于ios - UIControlStateHighlighted的UITabBarItem外观,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17930152/

10-12 01:52