Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Present View Controller right after Dismissing View Controller with no animation

I have a UIImagePickerController presented on screen. When I choose the photo I need to dismiss the PickerController then immediately present another PhotoEditController. Here is my code

picker.dismissViewControllerAnimated(false, completion: {
    self.presentViewController(editPhotoVC, animated: false, completion: nil)
})

There is a 0.1s flash between dismissing old VC and presenting new VC so the presentingViewController (self) is shown. How do I avoid that in an elegant solution not hacking it through? Thanks

like image 410
imObjCSwifting Avatar asked Nov 23 '25 17:11

imObjCSwifting


1 Answers

The standard way of implementation is to dismiss first view controller (VC) with animation and present second VC with animation.

However, depending on your view hierarchy, you could also have your second VC loaded first and then present first VC on top of it. With this simply dismissing first VC without animation should show underneath second VC without delay.

Third approach, as LLooggaann suggested, don't dismiss first VC and simply present second VC. Once done, dismiss the entire view controller hierarchy in one shot.

like image 139
Abhinav Avatar answered Nov 26 '25 09:11

Abhinav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!