トランプゲーム用のupdateUIメソッドがあり、カードの裏側に画像を追加しましたが、画像がいたるところにあり、問題を見つけることができません。
これが私の方法です。カードのサイズに合わせてサイズを変更するにはどうすればよいですか。
- (void)updateUI {
for (UIButton *cardButton in self.cardButtons) {
Card *card = [self.game cardAtIndex:[self.cardButtons indexOfObject:cardButton]];
[cardButton setTitle:card.contents forState:UIControlStateSelected];
[cardButton setTitle:card.contents
forState:UIControlStateSelected|UIControlStateDisabled];
cardButton.selected = card.isFaceUp;
cardButton.enabled = !card.isUnplayable;
cardButton.alpha = card.isUnplayable ? 0.3 : 1.0;
cardButton.imageEdgeInsets = UIEdgeInsetsMake(2, 2, 2, 2);
UIImage *cardBackImage = (cardButton.selected) ? nil : [UIImage imageNamed:@"benCardImag.png"];
[cardButton setImage:cardBackImage forState:UIControlStateNormal];
}
self.scoreCounter.text = [NSString stringWithFormat:@"Score: %d", self.game.score];
if (self.game.notification) {
self.notificationLabel.text = self.game.notification;
}
}