【发布时间】:2019-04-16 19:22:53
【问题描述】:
我想在用户选择图像后(通过单击图像视图)执行转场。
我已经检查了 segue id 并成功地连接了两个视图控制器。
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
// Executed when we select an image from the photo library.
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
// Sets the image to the image view (not really relevant because
// we push the user to the DetailVC, but let's leave it).
self.imageView.image = image
// Closing the image picker.
self.dismiss(animated: true, completion: nil)
// Performing segue (It doesn't perform!).
print("It gets to this point, but doesn't perform.")
self.performSegue(withIdentifier: "showDetail", sender: nil)
}
}
程序将图像设置为图像视图,在“执行”函数之后到达该打印语句,但不执行转场。
【问题讨论】: