【发布时间】:2016-05-22 05:33:46
【问题描述】:
我尝试在用户删除信息之前集成警报。 没有动画,行删除是动画的并且工作正常。但在 UIAlertAction 处理程序中,动画不再起作用:
UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil
message:@"Are you sure you want to delete the Inforamtion?"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:@"Delete" style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
// Find the cell taped Item using the position of the sender as located at relative to the tableview
CGPoint buttonPosition = [deleteTapped convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
// Update the data model
[self.checkout.paymentMethods removeObjectAtIndex:(indexPath.row -1)];
// Delete the row from the tableview
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:(UITableViewRowAnimationFade)];
[self.tableView endUpdates];
}];
[alert addAction:deleteAction];
UIAlertAction* keepAction = [UIAlertAction actionWithTitle:@"Keep" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
}];
[alert addAction:keepAction];
[self presentViewController:alert animated:YES completion:nil];
有什么建议可以让动画再次工作吗?
【问题讨论】:
标签: ios objective-c uitableview animation uialertcontroller