Ios UIPresentationController在经过巨大延迟后才呈现
这就是我如何展示我的自定义Ios UIPresentationController在经过巨大延迟后才呈现,ios,swift,Ios,Swift,这就是我如何展示我的自定义UIPresentationController: func presentOverlayController(controller: UIViewController) { controller.modalPresentationStyle = .Custom controller.transitioningDelegate = self presentViewController(controller, animated: true, c
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)
}
我在点击UITableViewCell
后显示控制器。只有当我轻触手机两次,它才会很快显示出来。然而,当我执行单次点击时,它也可以工作,但有很大的延迟(15-60秒之间)
原因是什么?
如何解决此问题?我也遇到了一个已知的
didselectrowatinexpath
错误,这就是我使用的解决方法
请尝试在didSelectRowAtIndexPath中执行此操作:
dispatch_async(dispatch_get_main_queue(), {
presentOverlayController(......)
})
参考资料:
试试这个:
dispatch_async(dispatch_get_main_queue()) {
self.presentViewController(controller, animated: true, completion: nil)
}