What is the correct way to resize or scale a UIScrollView to account for different aspect ratio screen sizes?
I have an app that uses a scroll view to select game levels. I have it laid out correctly for an iPad screen. It works fine on all screens of that same aspect ratio, i.e. iPad 1-4, retina and non-retina -- because the NGUI camera scales the whole GUI to fit the screen.
But when I go to an iPhone, iPhone 5, or Android screen, the aspect ratios are different. This results in the scroll view either not filling up all the available real estate, or going offscreen. I would like to resize the scroll view so it fits as snuggly as it does on the iPad.
I have spent many days trying to come up with the correct mathematical formula to calculate the updated settings for the enclosing UIPane's clipping rectangle and its XY offset, and also the UIScrollView's drag percent, reset position, etc. I have given up and hardcoded values for each expected screen size, which is really ugly and fragile code.
Does anyone know the magic formula?