[九九Tips]- http://www.lxweimin.com/users/bab86b3e8aa3/latest_articles
enabled和userInteractionEnabled的區(qū)別
下面兩種設(shè)置都能使按鈕不能被點(diǎn)擊
button.enabled = NO;
button.userInteractionEnabled = NO;
區(qū)別是:
userInteractionEnabled不改變按鈕狀態(tài),僅僅使得按鈕不能被點(diǎn)擊.
enabled更改會(huì)改變按鈕狀態(tài).
舉個(gè)例子
[button setTitleColor:[UIColor redColor] forState:UIControlStateDisabled];
button.enabled = NO; 按鈕進(jìn)入U(xiǎn)IControlStateDisabled狀態(tài);
button.userInteractionEnabled = NO; 按鈕不會(huì)進(jìn)入U(xiǎn)IControlStateDisabled狀態(tài).