我有一個tableview與多個自定義按鈕。當我選擇一個按鈕,該按鈕應該突出顯示,如果我選擇任何其他按鈕上一個選定的按鈕應該自動unhighlight,從而突出顯示當前選定按鈕。我該怎麼做....?自動取消選擇iphonetable中的上一個選定的按鈕在iphone
-(IBAction)buttonPressed:(UIButton *)sender {
tempBtn.selected = NO;
if (tempBtn != sender){
tempBtn = sender;
tempBtn.selected =YES;
[ tempBtn setBackgroundColor:[UIColor redColor]];
}
else{
tempBtn = nil;
}
}
我在做這一點,但這裏所有我點擊都轉變爲紅色的按鈕不刪除prevoius選擇顏色(紅色)我..How能做到嗎?
不清楚的問題! – Mutawe