3D Touch会冻结我的APP [英] 3D Touch freezes my APP

查看:190
本文介绍了3D Touch会冻结我的APP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我的问题等于:





2)强制 - 接触bug:
当我轻轻点击按钮时, UITransitionView 图层被创建但是透明(没有内容),此时我可以'与我的应用互动(因为顶层是空)。





更新:



代码:



HomeViewController

 扩展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)

返回balanceViewController
}

FUNC previewingContext(previewingContext:UIViewControllerPreviewing,commitViewController viewControllerToCommit:UIViewController中){
让balanceViewController = viewControllerToCommit作为! BalanceViewController
balanceViewController.shouldPresentCompleteMode = true
navigationController?.pushViewController(balanceViewController,animated:true)
}

}

On BalanceViewController

  @available(iOS 9.0,*)
覆盖func previewActionItems() - > [UIPreviewActionItem] {
让动作2 = UIPreviewAction(标题: Últimos5个迪亚斯úteis 样式:.DEFAULT){(动作,的viewController)在
self.delegate .balanceViewControllerFilterDidSelected(.FiveDays)$ B? $ b}
让action3 = UIPreviewAction(标题:action,style:.Default){(action,viewController)
self.delegate?。balanceViewControllerFilterDidSelected(.FiftyDays)
}
让措施4 = UIPreviewAction(标题: 行动,风格:.DEFAULT){(行动的viewController)在
self.delegate .balanceViewControllerFilterDidSelected(.ThirtyDays)
?}
让利action5 = UIPreviewAction(标题: 行动,风格:.DEFAULT){?(行动的viewController)在
self.delegate .balanceViewControllerFilterDidSelected(.SixtyDays)
}

返回[action2,action3,action4,action5]
}

更新2:



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



任何人都可以帮帮我?

解决方案

问题已解决



我找到了解决方案。问题是多余的Peek和Pop注册。我正在注册:



1)在上调用 registerForPreviewingWithDelegate(self,sourceView:view) viewDidLoad()



2)



也许他们互相冲突并解决这个问题我已经删除了故事板segue。


Maybe my problema is equals to:

Force Touch animation freezes if gently touched

App is freezing in 'peek and pop' implementation in iPhone 6s

1) Forces-touches without "bug": An UITransitionView layer is created to preview my View Controller. It works perfectly.

2) Forces-touches with "bug": When I gently tap over the button, the UITransitionView layer is created but its transparent (without content) and at this point I can't interact with my app (because the top layer is "empty").

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]
    }

UPDATE 2:

When I switch to another app and switch back to my app.. my device vibrates and peeks, but freezes again.

Anyone can help me?

解决方案

PROBLEM SOLVED

I've found the solution. The problem was a "redundant" Peek and Pop registration. I was registering:

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

2)

Maybe they conflict with each other and to solve this I've deleted the storyboard segue.

这篇关于3D Touch会冻结我的APP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆