2
很简单的情况。我有一个自定义的UIViewController来填充表单。当用户点击取消按钮时,我想要弹出提醒; “你确定要退出表单吗?你的编辑不会被保存”。如果他们击中了,VC会做动画然后关闭。的iOS UIAlertController中断动画
我将动画放置在UIAlertAction处理程序闭包中。但是,动画每次都会立即发生,我假设这是因为UIAlertController在解除按钮(按下按钮后)时产生动画,然后中断VC的动画。
任何想法?基本上看起来,只要按下按钮,处理程序就会被调用;如何在UIAlertController完成解除后调用处理程序。
编辑:下面是一些示例代码来说明这个问题:
let refreshAlert = UIAlertController(title: "Delete draft?", message: "Are you sure you want to discard this draft? It will not be saved.", preferredStyle: UIAlertControllerStyle.Alert)
refreshAlert.addAction(UIAlertAction(title: "Delete", style: .Destructive, handler: { (action: UIAlertAction!) in
self.animationInPresentionVC() // This animation occurs instantly, it seems to be interrupted by the dismissing alert controller
}))
没错,这就是我结束了做,工作很好...感觉像有点黑客虽然:(谢谢! – Josh