我有两个想要强制触摸的独立图像视图。
当前,我将其作为代码:
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,我希望它执行相同的操作。有什么建议吗?