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