zl程序教程

您现在的位置是:首页 >  其它

当前栏目

uitabbar 标题设置 button text attributes only respected for UIControlStateNormal

设置 for Text 标题 Only button Attributes
2023-09-11 14:15:06 时间

uitabbar 标题设置 button text attributes only respected for UIControlStateNormal

    [[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor whiteColor] }
                                             forState:UIControlStateSelected];

设置 tabbar 标题时,出现提示

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

 

解决方式:

  把上面 的  

"UIControlStateHighlighted" 换成 "UIControlStateSelected". 即可

 

http://stackoverflow.com/questions/10971705/uitabbaritem-appearance-settitletextattributes-keeps-logging-state-1-is-inte

http://stackoverflow.com/questions/3051958/changing-text-color-of-uitabbaritem