[英]a trouble in using “UIView animateWithDuration:…”
I'm having a trouble in animation. 我在动画方面遇到麻烦。 here is some codes:
这是一些代码:
//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];
}
What I want is when the "_isEdit == YES;" 我想要的是“ _isEdit == YES;”时 cells wobbling.
细胞摇晃。
But if I push to another ViewController when the cells wobbling, then dismiss. 但是,如果在单元格摆动时我推到另一个ViewController,则将其关闭。 The animation stop ("_isEdit" is still "YES")...
动画停止(“ _isEdit”仍然为“ YES”)...
How can I keep the animation working? 如何保持动画正常工作?
If I understood the question correctly you can just call the method again in viewDidAppear, and it should start again. 如果我正确理解了这个问题,则可以在viewDidAppear中再次调用该方法,它应该重新开始。
- (void)viewDidAppear:(BOOL)animated;
If the code is from: 如果代码来自:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath;
then you could try just reloading the tableView by calling reloadData on the tableView in the viewDidAppear method. 那么您可以尝试通过在viewDidAppear方法中的tableView上调用reloadData来重新加载tableView。 If the _isEdit is still equal to YES then the animation should trigger again.
如果_isEdit仍等于YES,则动画应再次触发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.