0
所以我已经子类化一个UIButton,我添加到它的唯一方法是setTitle(我正在使用图标字体,所以我为通过图标表示的那些按钮创建了一个Icon_UIButton)。Subclassed UIButton失去了亮点
我有这样的代码:
Icon_UIButton* button = [[Icon_UIButton alloc] init];
[button setTitle:@"R"]; //R is a specific icon in my icon font
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
这看起来像它的工作原理,但之后我设置一个按钮,使用选择:
[button setSelected:YES];
每当我点击并按住该按钮,它再次变黑。
这就像一个选定的Icon_UIButton忽略它的titleColor,当它被同时选中时,它是一个突出显示的状态。
有没有人遇到过这个?
是的,这是一个已知的问题提出了几次这里,那里有几个补丁,你可以搜索或生病尝试,找到一个真正的快。 – rezand
感谢您的回复@rezand我详尽地搜索了(感觉像),然后我空了。 – Adam