[英]a trouble in using “UIView animateWithDuration:…”
我在動畫方面遇到麻煩。 這是一些代碼:
//wobbling cells in collection view controller
if (_isEdit){
myCell.transform = CGAffineTransformMakeRotation(-0.01);
[UIView animateWithDuration:0.12
delay:0.0
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse|UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveLinear
animations:^{
myCell.transform = CGAffineTransformMakeRotation(0.01);
} completion:nil];
}
我想要的是“ _isEdit == YES;”時 細胞搖晃。
但是,如果在單元格擺動時我推到另一個ViewController,則將其關閉。 動畫停止(“ _isEdit”仍然為“ YES”)...
如何保持動畫正常工作?
如果我正確理解了這個問題,則可以在viewDidAppear中再次調用該方法,它應該重新開始。
- (void)viewDidAppear:(BOOL)animated;
如果代碼來自:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath;
那么您可以嘗試通過在viewDidAppear方法中的tableView上調用reloadData來重新加載tableView。 如果_isEdit仍等於YES,則動畫應再次觸發。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.