我有一个UILabe为我的匹配纸牌游戏写下“好匹配!”例如,如果您有匹配项,并且想在通知用户消息后使其消失。如何让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;
}];
}
}
}
阅读[核心动画节目指南](http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html),就是这样。 – CodaFi 2013-03-11 22:49:39