Change size handling to fit also for ex. modal view controllers

I've changed the code to also work in modal view controllers on iPad.