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)
onviewDidLoad()
2)
Maybe they conflict with each other and to solve this I've deleted the storyboard segue.