IOS and orientation [QUESTION]

runimals

  • Posts: 215
Hi mates,
Im working on some IOS extensions and I have found a common trouble with orientation changes.

I would need a way to get the screen orientation from haxe.
Is this possible?

And also, how can I listen for the rotation event? Event.RESIZE seems to not work.


« Last Edit: March 24, 2014, 11:14:12 am by Jon »

Jon

  • *
  • Posts: 17529
From Objective-C, it's pretty easy to get the orientation.

Code: [Select]
UIInterfaceOrientation o = [UIApplication sharedApplication].statusBarOrientation;

if(UIInterfaceOrientationIsLandscape(o))
{
}

else
{
}

From Haxe, theoretically, it's something like this but I'm not sure if it actually works since I don't think we use this at all.

Stage.getOrientation() == Stage.OrientationLandscapeLeft
Stage.getOrientation() == Stage.OrientationLandscapeRight