我有我想不通這個小問題對所有國家的形象。我有大約16個按鈕和它們連接爲一個出口收集到我的controller.And還他們有一個動作方法,這使得選擇的按鈕從default更改爲自己的狀態。我試圖改變所有按鈕的圖像只有默認狀態。所以我通過數組運行一個循環,並使用setImage:forState:method將它們的圖像設置爲默認狀態。但是該方法會更改所有狀態(默認和選定狀態)的圖像。setImage forState方法設置上的一個按鈕
這是我收集的出口setter方法
- (void) setCardsButton:(NSArray *)cardsButton
{
_cardsButton = cardsButton;
for (UIButton *button in cardsButton) {
[button setImage:[UIImage imageNamed:@"card.png"] forState:UIControlStateNormal];
}
[self updateView];
}