Tom*_*man 15 animation uitableview ios
有没有办法改变[table beginUpdates]/ [table endUpdates]动画的持续时间?
这是我尝试过的,没有运气:
选项1:
[UIView animateWithDuration:5.0 delay:0.0 options:(UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionOverrideInheritedDuration) animations:^{
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithArray:indexPaths] withRowAnimation:UITableViewRowAnimationTop];
[self.tableView endUpdates];
} completion:^(BOOL finished) {
}];
Run Code Online (Sandbox Code Playgroud)
选项2:
[CATransaction begin];
[CATransaction setCompletionBlock:^{
NSLog(@"I actually get called!");
}];
[CATransaction setAnimationDuration:5.0]; //but I don't work
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithArray:indexPaths] withRowAnimation:UITableViewRowAnimationTop];
[self.tableView endUpdates];
[CATransaction commit];
Run Code Online (Sandbox Code Playgroud)
Gau*_*ain 14
你为什么不试试UIView动画.
[UIView animateWithDuration:2 delay:0.2 options:UIViewAnimationOptionCurveEaseInEaseOut animations:^{
[self.tableView beginUpdates];
[self.tableView endUpdates];
} completion:^(BOOL finished) {
// code
}];
Run Code Online (Sandbox Code Playgroud)
这是Gautam Jain答案的Swift版本:
UIView.animate(withDuration: 2.0, delay: 0.0, options: .curveEaseInOut, animations: {
self.tableView.beginUpdates()
// ...
self.tableView.endUpdates()
}) { isFinished in
// ...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10847 次 |
| 最近记录: |