Back

SetOrientation

The SetOrientation method forces the screen to either "Portrait" or "Landscape" orientation.

 app.SetOrientation( orientation );

After using this function rotating the phone/tablet will have no effect on the app's orientation. To unlock the orientation call the function again using the orientation "Default".

See also GetOrientation

Example

function OnStart()
{
  app.SetOrientation( "Landscape" );

  lay = app.CreateLayout( "Linear", "Vertical" );
  txt = app.CreateText( "Hello" );
  txt.SetTextSize( 32 );
  lay.AddChild( txt );
  app.AddLayout( lay );
}
  Copy   Copy All    Run