Peek & Pop продолжает показывать следующий - PullRequest
0 голосов
/ 06 марта 2019

У меня есть это расширение

extension DevicesViewController : UIViewControllerPreviewingDelegate {

    func detailViewController(for indexPath: IndexPath) -> DeviceDetailViewController {
        guard let vc = storyboard?.instantiateViewController(withIdentifier: "DeviceDetailViewController") as? DeviceDetailViewController else {
            fatalError("Couldn't load detail view controller")
        }

        let cell = deviceTableView.cellForRow(at: indexPath) as! DeviceTableViewCell

        vc.title   = cell.deviceName?.text
        vc.device = loginAccount.cpeDevices[indexPath.row]

        return vc
    }

    func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
        if let indexPath = deviceTableView.indexPathForRow(at: location) {

            // Enable blurring of other UI elements, and a zoom in animation while peeking.
            previewingContext.sourceRect = deviceTableView.rectForRow(at: indexPath)

            return detailViewController(for: indexPath)
        }
        return nil
    }

    //ViewControllerToCommit
    func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {

        // Push the configured view controller onto the navigation stack.
        navigationController?.pushViewController(viewControllerToCommit, animated: true)
    }

}

В моем viewDidLoad ()

override func viewDidLoad() {
    super.viewDidLoad()

    if (self.traitCollection.forceTouchCapability == .available){
        //print("-------->", "Force Touch is Available")
        registerForPreviewing(with: self, sourceView: self.deviceTableView)
    }
    else{
        //print("-------->", "Force Touch is NOT Available")
    }

    ....

Я не знаю, почему оно продолжало показывать следующее из списка.

Как можно отладить это дальше?

...