Tuesday, October 1, 2019

Solution UIViewController Not Full Screen in iOS 13 ( Bonus My Extension )


Good october month all.

Have you installed iOS 13 in your device and you get suprise that some of your views have a gap on the top like picture above. It's bad or good news for us developer iOS. First it looks new and some people may love or hate it but in iOS 13 it becames default system to use it. You need to change it manually every view controller, if you have many it becames many job to do it.

Why we need to change it back to fullscreen, because I have view that has not to come back to previous view. It will be bad for user expirience to swipe up and go back and what they get only splashscreen and don't go anywhere again. It needs to reopen app again. This is my case in my apps.

Fortunely it's not hard to change it back to fullscreen again. It just needs one line code to change it but if you have function everytime you do presenting view controller. You just need to add one single line to make it fullscreen but if you have many present function in many classes. Good luck for you to change it one by one ok.

So this is the code you have to add. Of course you can find it online by google, but i need to tell you the best way is you use fullscreen. And I will give you my extension to present and dismiss with animation. Here we go...



You just focus on modalPresentationStyle = .fullScreen, if you want to make view controller fullscreen. Previously I have never used this modalPresentationStyle. Maybe I use it when I want to make view controller but only half of height.

In this extension you can take advantage to present and dismiss view easily. You can use animation previous with doing present actually. Thanks for reading.

No comments:

Post a Comment