簡體   English   中英

按下按鈕后如何替換按鈕中的圖像以保留為新圖像?

[英]How to replace an image in a button to remain as the new image after the button is pressed?

我正在創建一個游戲,用戶必須按下一個按鈕,當他按下按鈕時,按鈕的圖像應該永久改變......

- (IBAction)secondHintq:(id)sender {
hintView.text = @"Type in text here 2";
}

按鈕的出口被稱為:

candleChangeOne

這是怎么做的?

你可以試試這個:

- (IBAction)secondHintq:(id)sender 
{
    UIButton *button = sender;
    [button setImage:[UIImage imageNamed:@"YourImage"]forState:UIControlStateNormal];

    hintView.text = @"Type in text here 2";
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM