Home > Net >  Why does present/dismiss crash when animation is set to true?
Why does present/dismiss crash when animation is set to true?

Time:03-19

Within my root UIViewController I call up a submenu, second UIViewController, with the following code:

within root UIViewController

let myInvMenu = InvMenuCtrl()
myInvMenu.modalPresentationStyle = .fullScreen
myInvMenu.modalTransitionStyle = .partialCurl
present(myInvMenu, animated: false)

Within the new screen, I have a back button, I want dismiss it, and return to the original UIViewController.

dismiss(animated: false) 

In this post, I have the animation set to false, because that works fine. But if I set it to true, I crash on the dismissal.

From the docs, below I assumed that I didn't have to handle anything myself, but obviously if someone could tell me where my misunderstanding is:

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, UIKit asks the presenting view controller to handle the dismissal.

CodePudding user response:

Looks like the .modalTransitionStyle = .partialCurl is malfunctioning for some time if used for poresenting and dismissing of UIViewController Try This Answer to make the same presentation using containment of UIViews or create yourself custom UIPresentationController with custom animation that mimics .partialCurl transition. Hopefully you will find right solution that fits you.

  • Related