Tocropviewcontroller: Animation for presentation

Created on 5 Oct 2016  ·  4Comments  ·  Source: TimOliver/TOCropViewController

Whenever I present the viewController with:
presentViewController(cropViewController, animated: true, completion: nil)
I get a fade in animation, same story when I dismiss it, it shows me a fade out animation.

I wanted to revert it to the default iOS animations, slide from bottom when presenting and sliding to bottom when dismissing.

I tried return nil; for both animationControllerForPresentedController and animationControllerForDismissedController, but it only worked for the dismiss, when I present the viewcontroller I still get the fade in result.

Any idea how to revert to the default iOS presentation animation?

enhancement question

All 4 comments

Hi @erickva! You were on the right track with making the animation controller return nil, but one other thing you had to do was specify the modalTransitionStyle of the controller itself:

TOCropViewController *cropController = [[TOCropViewController alloc] init];
cropController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

I just pushed a new version that will disable the animation controller if the style is set to vertical, so if you update to that one, all you should need to do is add that extra line of code. :)

I hope that helped!

You are a Legend! Thank you.

No worries! Glad I could help! :) Enjoy!

For swift, the only way I could change the modal presentation style was by accessing the child view controller: cropViewController.childViewControllers.first?.modalTransitionStyle = .coverVertical. Is there a better way?

Was this page helpful?
0 / 5 - 0 ratings