title: Delphi/Firemonkey Change iOS screen rotation at runtime
body: <p>basically all I want to achieve is when a user is in a certain part of the App to change the screen rotation as needed, I have this working for Andriod and I can not see why it shouldn't work for iOS</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var
    ScreenService: IFMXScreenService;
    OrientSet: TScreenOrientations;
  begin
      if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) 
      then
      begin
          OrientSet := [TScreenOrientation.soLandscape];//&lt;- Break point set here and line is executed
          ScreenService.SetScreenOrientation(OrientSet);
      end;
  end;
  </code></pre>
  
  <p>Taken from here : <a href="https://stackoverflow.com/questions/25488475/how-to-prevent-screen-rotation-with-android-development-in-delphi-xe5-firemonkey">How to prevent screen rotation with android development in delphi xe5 Firemonkey</a></p>
  
  <p>The ScreenService.SetScreenOrientation is executed and does not raise a exception but the orientation is not changed, I have also set <strong>Enable custom orientation</strong> in Project>Options>Application>Orientation but this also didn't have any effect.</p>
  
  <p>What is strange to me is that if it was not supported then shouldn't  this </p>
  
  <pre><code>if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) 
  </code></pre>
  
  <p>Return false? and not even enter the begin</p>
  
  <p>I added a test button to check the screen orientation after I set it to landscape only with</p>
  
  <pre><code>if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) 
  then
  begin
      case ScreenService.GetScreenOrientation of
          TScreenOrientation.Portrait: ShowMessage('Portrait');
          TScreenOrientation.Landscape: ShowMessage('landscape');
          TScreenOrientation.InvertedPortrait: ShowMessage('Inverted-Portrait');
          TScreenOrientation.InvertedLandscape: ShowMessage('Inverted-Landscape');
          else ShowMessage('not set');
      end;
  end;
  </code></pre>
  
  <p>And if it was in Portrait after setting it to Landscape it still says Portrait</p>
  
  <p><strong>Update 1</strong> : I have also tried changing </p>
  
  <pre><code>OrientSet := [TScreenOrientation.soLandscape] // &lt;- Deprecated
  </code></pre>
  
  <p>to</p>
  
  <pre><code>OrientSet := [TScreenOrientation.Landscape]
  </code></pre>
  
  <p>but the behaviour is still the same </p>