let cropViewController = CropViewController(image: images[0])
cropViewController.delegate = self
self.present(cropViewController, animated: true, completion: nil)
从委托方法中取消此视图控制器,显示黑屏
func cropViewController(_ cropViewController: CropViewController,
didCropToImage image: UIImage,
withRect cropRect: CGRect,
angle: Int) {
// 'image' is the newly cropped version of the original image
cropViewController.dismiss(animated: true, completion: {
self.setImageAndReloadRow(image: image)
})
}
Xcode 11.5和iOS13.5
最佳答案
选择图像并裁剪后,我也遇到了同样的问题,只有黑屏出现了。
更换
cropViewController.dismiss(animated: true, completion: nil).
用let viewController = cropViewController.children.first!
viewController.modalTransitionStyle = .coverVertical
viewController.presentingViewController?.dismiss(animated: true, completion: nil)