This is how I present my custom 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)
}
I present my controller once I tap on UITableViewCell
. It is presented very quickly only if I tap on cell twice. However, when I perform single tap, then it works as well but with huge delay (between 15-60 seconds).
What is the reason? How to workaround it?
There is a known bug with didSelectRowAtIndexPath
that occurred to me as well, and this is the workaround I used.
Try to do this inside your didSelectRowAtIndexPath
:
dispatch_async(dispatch_get_main_queue(), {
presentOverlayController(......)
})
References:
Try this:
dispatch_async(dispatch_get_main_queue()) {
self.presentViewController(controller, animated: true, completion: nil)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.