iOS button 点击高亮的时候不变灰, 把按钮类型改为自定义即可
_continueBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_continueBtn setBackgroundImage:[UIImage imageNamed:@"mhsq_history_continue"] forState:UIControlStateNormal];
[_continueBtn setBackgroundImage:[UIImage imageNamed:@"mhsq_history_continue_h"] forState:UIControlStateHighlighted];
如果类型是 System
_continueBtn = [UIButton buttonWithType:UIButtonTypeSystem];
_continueBtn.adjustsImageWhenHighlighted = NO;
或者把图片设置为同一张,也行

本文介绍了解决iOS UIButton在点击高亮时保持原色的方法。通过将按钮类型更改为自定义,并调整图片资源,可以避免按钮在高亮状态下的颜色变化。适用于希望保持按钮视觉一致性的iOS应用开发者。
697

被折叠的 条评论
为什么被折叠?



