1

I made a custom UIAlertController in the upper part of it is I UICollectionView with photos. I present TOCropViewController (this is UIViewController) of a custom from my UIAlertController, and when I'm TOCropViewController, the UIAlertController be in the wrong position. Also, I did a little experiment to find out exactly what the problem is not TOCropViewController, and presented a default UIViewController, but the result is the same. Please tell me how to fix it?

So I present any controller from UIAlertController

private func presentCropViewController(_ image: UIImage) {
    let cropViewController = TOCropViewController(croppingStyle: .circular, image: image)

    DispatchQueue.main.async { [weak self] in
        self?.present(cropViewController, animated: true, completion: nil)
    }
}

this give the same result

  let testVC = UIViewController()
        testVC.view.backgroundColor = .red

        DispatchQueue.main.async { [weak self] in
            self?.present(testVC, animated: true, completion: {
                Timer.scheduledTimer(withTimeInterval: 5, repeats: false, block: { (timer) in
                    testVC.dismiss(animated: true, completion: nil)
                })
            })
        }

When the controller which was presented the result of such a hiding.

enter image description here

Alexander Khitev
  • 6,417
  • 13
  • 59
  • 115
  • I found much more information [here](http://stackoverflow.com/questions/27028983/uialertcontroller-is-moved-to-buggy-position-at-top-of-screen-when-it-calls-pre) I will use this [solution](http://stackoverflow.com/a/37713178/4981515) – Alexander Khitev Feb 08 '17 at 11:42
  • Possible duplicate of [UIAlertController is moved to buggy position at top of screen when it calls \`presentViewController:\`](http://stackoverflow.com/questions/27028983/uialertcontroller-is-moved-to-buggy-position-at-top-of-screen-when-it-calls-pre) – pkamb May 04 '17 at 18:59

0 Answers0