[英]UIButton title disappears when button disabled
我有一個系統UIButton
,當我這樣做時
self.abutton.enabled = NO;
該button's
標題消失了,我不希望它消失,我只是希望它不可單擊。 我該怎么辦?
yourButton.userInteractionEnabled = NO;
OR
yourButton.enabled = NO;
[yourButton setTitle:@"ButtonDisabled" forState:UIControlStateDisabled];
國家名單:
UIControlStateNormal
UIControlStateHighlighted
UIControlStateDisabled
UIControlStateSelected
UIControlStateApplication
UIControlStateReserved
您是否已為按鈕的禁用狀態添加標題,例如-
[YOUR_BTN setTitle:@"xyz" forState:UIControlStateDisabled];
如果不是添加它
根據我的理解,您可以使用以下代碼。 希望這會幫助你。
self.aButton.userInteractionEnabled = NO;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.