//聯(lián)系人:石虎 QQ:1224614774 昵稱:嗡嘛呢叭咪哄
? ? ? ? ? ? ? QQ群:807236138群稱:iOS 技術(shù)交流學(xué)習(xí)群
一滑臊、概念
UIButton 樣式 :ButtonWithType:
? ? UIButtonTypeCustom:? ? ? ? ? ? 自定義風(fēng)格
? ? UIButtonTypeRoundedRect : 圓角矩形
? ? UIButtonTypeDetailDisclosure:藍(lán)色小箭頭,主要做詳細(xì)說明用
? ? UIButtonTypeInfoLight:? ? ? ? ? 亮色感嘆號(hào)
? ? UIButtonTypeInfoDark:? ? ? ? ? 暗色感嘆號(hào)
? ? UIButtonTypeContactAdd:? 十字加號(hào)按鈕
二鬓椭、解決倒計(jì)時(shí)button title閃爍問題
button title閃爍GIF圖:
方式一:
1.只要把button的類型改成custom即可关划。
2.代碼:
? ? ? ? UIButton *countBtn = [UIButton buttonWithType:UIButtonTypeCustom];
3.xib:
4.原因:因?yàn)槟J(rèn)的button類型是system的自定義有些屬性會(huì)導(dǎo)致問題贮折。
方式二:
1.如果不修改類型那就先設(shè)button.titleLabel.text,再設(shè)button setTitle: forState: 就可以解決倒計(jì)時(shí)閃爍問題
2.代碼:
_countBtn.titleLabel.text = [NSString stringWithFormat:@"%zd 跳過",_count];
[_countBtn setTitle:[NSString stringWithFormat:@"%zd 跳過",_count] forState:UIControlStateNormal];
button title正常GIF圖:
注意:推薦使用方式一,如果是老項(xiàng)目可以考慮使用方式二踊赠。