1
我试图在无限循环中显示带有两个更改字符串(如横幅)的间歇标签。 第一个标签应该淡入。之后,它应该淡出,让第二个标签也一样。然后无限或长时间地重复这个序列。 该标签位于UITableView的子类中。淡入/淡出2标签桌面视图内的无限循环
我想这个至今:
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
...
// Inside a cell an at its own section of the tableview
cell.label1.alpha = 1;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationRepeatCount:INFINITY];
[cell.label1 setAlpha:0];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView commitAnimations];
cell.label2.alpha = 1;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationRepeatCount:INFINITY];
[cell.label1 setAlpha:0];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView commitAnimations];
...
}
此代码工作正常,但由于在label1的褪色是过路淡出LABEL2效果并不清楚,很是怪异。 那么,我该如何在两个动画之间做个休息,以清楚看到衰落标签?
使用关键帧动画http://commandshift.co.uk/blog/2014/04/01 /停止嵌套动画块/ – Paulw11