Author Topic: Rotating UI elements as response to device orientation  (Read 3754 times)

duncanx

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Rotating UI elements as response to device orientation
« 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).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Rotating UI elements as response to device orientation
« Reply #1 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.