应用程序在iPhone 6s的'偷看和弹出'实现中很快 [英] App is freezing in 'peek and pop' implementation in iPhone 6s
问题描述
我已经在我的应用程序中实现了窥视和弹出,它完美无缺。但是在不断尝试7-8次时,该应用程序冻结了窥视视图。我唯一的选择是杀死应用程序并重新运行。请让我知道冻结的原因。我在我的项目中使用了以下代码来查看和弹出:
I have implemented peek and pop in my app and it works perfectly. But on continuously trying it for 7-8 times, the app freezes on peek view. The only option I have is to kill the app and re-run. Please let me know the reason for the freeze. I have used the following code for peek and pop in my project:
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)
}
推荐答案
这是我几个月前在工程师面前提出的一个问题,到目前为止他们没有回答。如果调试视图层次结构,您会注意到UITransitionView图层是最顶层的视图,并且未被删除。这就是导致应用冻结的原因。实际上,应用程序的功能并未冻结 - 它仍然按预期工作,但UI卡住了。这是我在Stack Overflow上的原始帖子:如果轻轻触摸,Force Touch动画会冻结
This is an issue I have brought up to the engineers over at Apple months ago with no answer from them so far. If you debug the view hierarchy, you'll notice that a UITransitionView layer is the top-most view and it is not being removed. That's what's causing the app to freeze. Actually, the functionality of the app isn't frozen - it still works as expected, but the UI is "stuck." Here is my original post here on Stack Overflow: Force Touch animation freezes if gently touched
这篇关于应用程序在iPhone 6s的'偷看和弹出'实现中很快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!