简体   繁体   中英

UIViewController with Custom Transition; Lost After Modal Presentation

Scenario: one UIViewController uses a custom transition to present another VC. This VC does not take up the entire screen; it's appearing as a layer on top of the first. Everything here is working great.

Now the presented VC wants to show a UIImagePickerController — to take a photo. But once that controller is dismissed, the second VC is displayed as a full-screen view: the effects of the original transition have been lost.

I've borrowed someone else's demo code for UIViewController transitions to quickly demonstrate this effect. Once you add the partial-screen second VC and bring up the camera view, dismissing it leaves you with a full-screen second view.

I've been unable to find other folks having this issue, but its repeatability suggests a framework bug.

https://github.com/aaronvegh/CustomViewControllerTransition

Found the solution: you have to set a modalPresentationStyle property on the camera VC before showing it. In my instance I set it to UIModalPresentationCustom, and that resolved the issue: when the camera is dismissed, the underlying custom transition bounds are retained.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM