I want to present a custom-sized modal view controller with animation from the bottom. I can achieve this animation with ModalPresentationStyle to FormSheet, but it forces me to use the default size which is 540×620 and my view doesn’t fit.
How do I make perform a similar transition to an arbitrarily sized view (controller) placed in center of the screen?
I didn’t find a way to do it from the modal controller itself so I created a class and an extension method:
This is roughly how I use it:
It is convenient that I don’t need to specify the size explicitly because it uses root View’s bounds from the interface builder. I’m not sure how this reacts to autorotate, it may need some tuning. I’m also using two extension methods here:
And this is it.