iOS*_*mer 7 iphone ios swift peek-pop
我已经在我的应用程序中实现了窥视和弹出,它完美无缺.但是在不断尝试7-8次时,应用程序冻结在窥视视图上.我唯一的选择是杀死应用程序并重新运行.请让我知道冻结的原因.我在我的项目中使用了以下代码来查看和弹出:
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)
}
Run Code Online (Sandbox Code Playgroud)
这是我几个月前向苹果工程师提出的一个问题,但到目前为止他们还没有得到答复。如果您调试视图层次结构,您会注意到 UITransitionView 层是最顶层的视图,并且不会被删除。这就是导致应用程序冻结的原因。实际上,应用程序的功能并没有冻结 - 它仍然按预期工作,但用户界面“卡住了”。这是我在 Stack Overflow 上的原始帖子:如果轻轻触摸,Force Touch 动画就会冻结