Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - quietpixel

Pages: [1]
1
Thank you, ArenMook, that solved the problem for me, without having to try calculating the correct values myself.  I did not know this feature had been added to the most recent versions of NGUI.

A very nice upgrade!

Is there an easy way to make the anchor distance be a certain percentage of screen width or height?  I am able to change the anchor distance via code to maintain a nice gap on the sides on all screen sizes, but am curious if there is a way to do this automatically?

2
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?

Pages: [1]