IOS倒计时设置UIButton标题title的抖动问题

来源:互联网 发布:中国贫富差距数据 编辑:程序博客网 时间:2024/05/28 17:05

例如,在发送验证码后,button状态需要变为disable,每隔一秒显示倒计时时间,仅仅设置
[button setTitle:title forState:UIControlStateDisabled];

[button setTitle:title forState:UIControlStateNormal];
是不够的,按钮会一闪一闪的抖动。


需要同时设置:
button.titleLabel.text = title;
[button setTitle:title forState:UIControlStateDisabled];

button.titleLabel.text = title;
[button setTitle:title forState:UIControlStateNormal];

0 0