Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: duncanx on June 20, 2013, 05:26:25 AM

Title: Rotating UI elements as response to device orientation
Post by: duncanx on June 20, 2013, 05:26:25 AM
Recommend simplest way to rotate a UI element (button, sprite, whatever) when the user changes the device orientation?

Ideally I'd like the UI element to stay where it is, but rotate in place. For example the way some of the UI elements in a most default camera apps behave. I know I could write something custom, but figured I'd see what others have done first or potentially NGUI already handles it (but I can't find it).
Title: Re: Rotating UI elements as response to device orientation
Post by: Nicki on June 20, 2013, 06:46:59 AM
NGUI doesn't really handle it. The UIRoot's height changes if its pixel perfect, so it statys the same size on the screen.

If you have the height to fixedSize, then stuff is resized to be the same size to the relative height - it will "fit" the old height into the new height, so if it changes from 960 to 640, everything will be smaller by the same factor.

Either way, it's a good idea to manually handle it yourself.