偷看时详细视图数据令人困惑

时间:2017-05-01 13:11:38

标签: swift master-detail 3dtouch

我正在尝试为我的应用实施3D触控支持,目前我遇到了一些问题

//3D Touch - Peek
    func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {

        guard let indexPath = tableView.indexPathForRow(at: location),
            let cell = tableView.cellForRow(at: indexPath) as? CustomCell else {return nil}

        let identifier = "TemplateTestViewController"
        guard let BarVC = storyboard?.instantiateViewController(withIdentifier: identifier) as?
            TemplateTestViewController else { return nil }

        //Set Ups the Image Template :
        BarVC.HeaderprofileImage?.image = UIImage(named: ProfileImages[indexPath.row] + "jpg")
        //Sets Up Bar Or Club Text :
        BarVC.BarOrClubLabel?.text = ProfileBarOrClub[MyIndex]
        //Sets Up Age Text :
        BarVC.AgeLabel.text = AgeText[MyIndex]
        //Sets Up Phone Number Text :
      BarVC.ProfilePhoneNumberLabel?.setTitle(ProfilePhoneNumbers[indexPath.row], for: .normal)

        if #available(iOS 9.0, *) {
            previewingContext.sourceRect = cell.frame
        } else {
            // Fallback on earlier versions
        }

        return BarVC
    }

正如您所看到的,我正在尝试使用data更改每个单元格之间的MyIndex,这基本上是indexPath.row。我没有得到任何错误,但是当我运行应用程序时,不同的单元格之间的数据没有被更改...

任何帮助都会非常感激!

0 个答案:

没有答案