title: Locking orientation at run-time on demand
body: <p>I currently have the following code:</p>
  <pre><code>PROCEDURE LockOrientation(Orientation : TOrientation);
    BEGIN
      {$IFDEF MOBILE }
        VAR ScreenService : IFMXScreenService;
        IF TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,IInterface(ScreenService)) THEN BEGIN
          VAR OrientSet : TScreenOrientations;
          CASE Orientation OF
             TOrientation.Portrait : OrientSet:=[TScreenOrientation.Portrait];
            TOrientation.Landscape : OrientSet:=[TScreenOrientation.Landscape]
          END;
          ScreenService.SetSupportedScreenOrientations(OrientSet)
        END
      {$ENDIF }
    END;
  </code></pre>
  <p>to force a specific orientation (and a companion UnlockOrientation when I want to &quot;release&quot; it again). It works fine on Android, but not on iOS.</p>
  <p>How do I (programmatically) &quot;lock&quot; the orientation to a specific value (it'll always be the &quot;current&quot; orientation) and (later on) unlock it (make it fully rotatable) on iOS?</p>