【问题标题】:UIPresentationController is being presented after huge delayUIPresentationController 在巨大延迟后呈现
【发布时间】:2016-07-19 09:28:55
【问题描述】:

这就是我展示我的自定义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 秒之间)。

是什么原因? 如何解决?

【问题讨论】:

    标签: ios swift


    【解决方案1】:

    我也遇到了didSelectRowAtIndexPath 的一个已知错误,这是我使用的解决方法。

    尝试在您的 didSelectRowAtIndexPath 中执行此操作:

    dispatch_async(dispatch_get_main_queue(), {
        presentOverlayController(......)
    })
    

    参考资料:

    【讨论】:

      【解决方案2】:

      试试这个:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-10-21
        • 1970-01-01
        • 2017-08-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多