3D Touch 冻结我的应用程序

2023-12-01

也许我的问题等于:

如果轻轻触摸,力触动画会冻结

iPhone 6s 中的“peek and pop”实施中应用程序冻结

1)无“bug”的强制触摸: 一个UITransitionView创建图层是为了预览我的视图控制器。它工作完美。

enter image description here

2)用“bug”强制触摸: 当我轻轻点击按钮时,UITransitionView图层已创建,但它是透明的(没有内容),此时我无法与我的应用程序交互(因为顶层是“空”)。

enter image description here

UPDATE:

Code:

HomeViewController

extension HomeViewController: UIViewControllerPreviewingDelegate {

    func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
        if #available(iOS 9.0, *) {
            previewingContext.sourceRect = balanceButton!.bounds
        }

        let balanceViewController = UIStoryboard.balanceViewController()
        balanceViewController.delegate = self
        balanceViewController.account = account
        balanceViewController.preferredContentSize = CGSize(width: 0.0, height: 118)
        navigationController?.preferredContentSize = CGSize(width: 0.0, height: 118)

        return balanceViewController
    }

    func previewingContext(previewingContext: UIViewControllerPreviewing, commitViewController viewControllerToCommit: UIViewController) {
        let balanceViewController = viewControllerToCommit as! BalanceViewController
        balanceViewController.shouldPresentCompleteMode = true
        navigationController?.pushViewController(balanceViewController, animated: true)
    }

}

On BalanceViewController:

@available(iOS 9.0, *)
    override func previewActionItems() -> [UIPreviewActionItem] {
        let action2 = UIPreviewAction(title: "Últimos 5 dias úteis", style: .Default) { (action, viewController) in
           self.delegate?.balanceViewControllerFilterDidSelected(.FiveDays)
        }
        let action3 = UIPreviewAction(title: "action", style: .Default) { (action, viewController) in
            self.delegate?.balanceViewControllerFilterDidSelected(.FiftyDays)
        }
        let action4 = UIPreviewAction(title: "action", style: .Default) { (action, viewController) in
            self.delegate?.balanceViewControllerFilterDidSelected(.ThirtyDays)
        }
        let action5 = UIPreviewAction(title: "action", style: .Default) { (action, viewController) in
            self.delegate?.balanceViewControllerFilterDidSelected(.SixtyDays)
        }

        return [action2, action3, action4, action5]
    }

更新2:

当我切换到另一个应用程序并切换回我的应用程序时......我的设备会振动并查看,但会再次冻结。

有人可以帮助我吗?


问题解决了

我找到了解决方案。问题在于“冗余”的 Peek 和 Pop 注册。我正在注册:

1) Call registerForPreviewingWithDelegate(self, sourceView: view) on viewDidLoad()

2) enter image description here

也许它们彼此冲突,为了解决这个问题,我删除了故事板转场。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

3D Touch 冻结我的应用程序 的相关文章

随机推荐