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