嗨,我需要为放置在每个 tableviewcell 内的标签设置淡入淡出动画。此动画应每 5 秒调用一次。所以我在 cellForRowAtIndexPath 中给出了动画。但是这个动画应该连续发生。我试着把它放在 nstimer 中,但是这个动画只发生在最后一行的标签上。所以现在我给了 cellForRowAtIndexPath。到目前为止,所有标签都会出现动画,但它仅在调用 cellforrowatindexpath 时发生。请指导我。这是我在 cellforrowatindexpath 的单元格创建之外给出的代码
UILabel *rewardPtLabel = (UILabel*)[cell.contentView viewWithTag:kRewardlabelTag];
rewardPtLabel.text = [NSString stringWithFormat:@"%@ %@",[appRecord objectForKey:@"ProductReward"],@""];//rewardPoints
rewardPtLabel.alpha = 0;
rewardPtLabel.textColor=[UIColor redColor];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:2];
rewardPtLabel.alpha = 1;
[UIView commitAnimations];
rewardPtLabel.textColor=[UIColor greenColor];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:2];
rewardPtLabel.alpha = 0;
[UIView commitAnimations];