SWIFT 3D触摸窥视并弹出多个图像

时间:2020-03-06 03:30:37

标签: swift

我有两个想要强制触摸的独立图像视图。

当前,我将其作为代码:

func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
        print(convertedLocation)
        let otherViewController = self.storyboard?.instantiateViewController(withIdentifier: "preview") as? PicViewController
        otherViewController?.image = FirstImage.image!
        return otherViewController
    }

    func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
        let otherViewController = self.storyboard?.instantiateViewController(withIdentifier: "preview") as? PicViewController
        otherViewController?.image = FirstImage.image!
        show(otherViewController!, sender: self)
    }

这适用于一个图像(FirstImage),但是如果用户选择SecondImage,我希望它执行相同的操作。有什么建议吗?

0 个答案:

没有答案