UIPresentationController在经过大量延迟后呈现

时间:2016-07-19 09:28:55

标签: ios swift

这是我展示自定义$crud->set_crud_url_path(site_url('admin/products/list')); 的方式:

UIPresentationController

点击func presentOverlayController(controller: UIViewController) { controller.modalPresentationStyle = .Custom controller.transitioningDelegate = self presentViewController(controller, animated: true, completion: nil) } //MARK: - UIViewControllerTransitioningDelegate public func presentationControllerForPresentedViewController(presented: UIViewController, presentingViewController presenting: UIViewController, sourceViewController source: UIViewController) -> UIPresentationController? { return OverlayPresentationController(presentedViewController: presented, presentingViewController: presenting) } 后,我会出示我的控制器。只有当我点击两次细胞时,它才会很快呈现。但是,当我执行单击时,它也能正常工作但延迟很大(15-60秒之间)。

是什么原因? 如何解决它?

2 个答案:

答案 0 :(得分:2)

我发现了didSelectRowAtIndexPath的已知错误,这也是我使用的解决方法。

尝试在didSelectRowAtIndexPath

中执行此操作
dispatch_async(dispatch_get_main_queue(), {
    presentOverlayController(......)
})

参考文献:

答案 1 :(得分:1)

试试这个:

dispatch_async(dispatch_get_main_queue()) {
    self.presentViewController(controller, animated: true, completion: nil)
}