我已经在我的应用程序中实现了 peek and pop 并且它运行良好。但是在连续尝试 7-8 次后,该应用程序冻结在 peek view 上。我唯一的选择是杀死应用程序并重新运行。请告诉我冻结的原因。我在我的项目中使用了以下代码进行查看和弹出:
var isPresentedBy3Dtouch: Bool = false
var passedDetails:DetailModel!
func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView?.indexPathForRowAtPoint(location)
else { return nil }
guard let cell = tableView?.cellForRowAtIndexPath(indexPath)
else { return nil }
guard let detailViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Navigation") as? UINavigationController
else { return nil }
(detailViewController.topViewController as! DetailViewController).passedDetails = self.customerLists[indexPath.row]
(detailViewController.topViewController as! DetailViewController).isPresentedBy3Dtouch = true
detailVC.preferredContentSize = CGSize(width: 0.0, height: 480.0)
previewingContext.sourceRect = cell.frame
return detailVC
}
func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit :UIViewController) {
showViewController(viewControllerToCommit, sender: self)
}