ストーリーボードには 3 つのコントロール タイプがあります (bigButton0....bigButton11、btnSmall0...btnSmall11、lbl0...lbl11)。
btnBig0~btnBig11全てに同じ画像を割り当てたいです。よりスマートなソリューションが見つからなかったため、現在、長い冗長コードを使用していますが、実行時にこれを行う必要があります。
コードを短くする方法を教えてもらえますか? どうもありがとうございました。
NSString * sImageName = [NSString stringWithFormat:@"button_bg_%.0f_%.0f_normal.png", L_CELL_W, L_CELL_H];
[bigButton0 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton1 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton2 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton3 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton4 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton5 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton6 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton7 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton8 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton9 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton10 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
[bigButton11 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateNormal];
sImageName = [NSString stringWithFormat:@"button_bg_%.0f_%.0f_down.png", L_CELL_W, L_CELL_H];
[bigButton0 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton1 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton2 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton3 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton4 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton5 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton6 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton7 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton8 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton9 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton10 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];
[bigButton11 setImage:[UIImage imageNamed:sImageName] forState:UIControlStateHighlighted];