我有一个用于匹配纸牌游戏的 UILabel,上面写着“好匹配!” 例如,如果您有匹配项,并且我想在通知用户消息后使其消失。
用什么方法做到这一点?我可以让它消失..?谢谢。
这是我的 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.unplayble;
if (card.unplayble) {
cardButton.alpha = 0.1;
}
self.scoreCounter.text = [NSString stringWithFormat:@"Score: %d", self.game.score];
if (self.game.notification) {
[UIView animateWithDuration:2 animations:^{
self.notificationLabel.text = [NSString stringWithFormat:@"%@", self.game.notification];
self.notificationLabel.alpha = 0;
}];
}
}
}