ios - Detecting iPad orientation in Delphi -


i'd have thought there onrotate event in xe4 appears onresize used. got that.

however, need determine orientation device is. i'm sure it's simple google can't help!

to detect current orientation of device can use statusbarorientation method part of uiapplication class.

try sample

uses   iosapi.uikit;  function sharedapplication:uiapplication; begin   result:=tuiapplication.wrap(tuiapplication.occlass.sharedapplication); end;  procedure tform23.button1click(sender: tobject); var   lorientation: cardinal; begin   lorientation := sharedapplication.statusbarorientation;   if (lorientation = uideviceorientationlandscapeleft) or (lorientation = uideviceorientationlandscaperight)     showmessage('landscape')   else   if (lorientation = uiinterfaceorientationportrait)     showmessage('portrait'); end; 

Comments