Anees
Anees

Reputation: 522

Dismissing modal view controller shows black screen in ( iOS13.5 Xcode 11.5)

let cropViewController = CropViewController(image: images[0])
cropViewController.delegate = self

self.present(cropViewController, animated: true, completion: nil)

Dismissing this view controller from a delegate method , shows a black screen

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 and iOS13.5

Upvotes: 2

Views: 621

Answers (1)

Mukesh
Mukesh

Reputation: 797

I had also same issue after selecting image and cropped,only black screen was appearing.

Replace

cropViewController.dismiss(animated: true, completion: nil).

With

let viewController = cropViewController.children.first! 
viewController.modalTransitionStyle = .coverVertical 
viewController.presentingViewController?.dismiss(animated: true, completion: nil)

Upvotes: 1

Related Questions