UIAlertController的Action事件反应有点慢?

直接贴上Button的点击事件:

    func cancelButton() {
        
        let alertCtrl = UIAlertController.init(title: "是否放弃修改支付密码?", message: nil, preferredStyle: UIAlertControllerStyle.alert)
        alertCtrl.addAction(UIAlertAction.init(title: "否", style: UIAlertActionStyle.cancel, handler: nil))
        alertCtrl.addAction(UIAlertAction.init(title: "是", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction) in
            self.navigationController?.popViewController(animated: true)
        }))
        self.present(alertCtrl, animated: true, completion: nil)
    }

navigationControllerpop感觉特别慢,点击之后,感觉有个2秒的延迟才返回上层界面,微信的放弃修改支付密码,点完之后界面立马返回了,有没有谁知道有什么办法?

阅读 4.5k
2 个回答

我用你代码写了一个demo,发现并没有2秒的延迟。

说明你代码的问题不是这一块内容。

你的闭包内代码加入主线程试试

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题