UIButton选择状态下长按时会变回原始状态
问题大概就像这样
(请无视那红字)
一般而言这是高亮状态的设置有所缺乏。完善代码如下:
[_pupilBtn setImage:[UIImage imageNamed:@"a1"]
forState:UIControlStateNormal];
[_pupilBtn setImage:[UIImage imageNamed:@"a1"]
forState:UIControlStateHighlighted];
[_pupilBtn setImage:[UIImage imageNamed:@"a2"]
forState:UIControlStateSelected];
[_pupilBtn setImage:[UIImage imageNamed:@"a2"]
forState:UIControlStateSelected | UIControlStateHighlighted];
本文来自博客园,作者:MrYu4,转载请注明原文链接:https://www.cnblogs.com/MrYU4/p/15778888.html