Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Orientation lock does not work on iOS #16

Open
tompi opened this issue Aug 2, 2018 · 4 comments
Open

Orientation lock does not work on iOS #16

tompi opened this issue Aug 2, 2018 · 4 comments

Comments

@tompi
Copy link

tompi commented Aug 2, 2018

Tried to use the nuget package without success, so I cloned the repo and started the sample app on an ipad with ios 11.3.1.

Screen rotates even if label says locked...

This is the case for both the samples-solution and the TestNugetDeviceOrientationPlugin

@DKANomad
Copy link

DKANomad commented Sep 13, 2018

If you haven't fixed this yet, I was able to get it working by adding the code:

[Export("application:supportedInterfaceOrientationsForWindow:")]    
public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, IntPtr forWindow)
{
     return Plugin.DeviceOrientation.DeviceOrientationImplementation.SupportedInterfaceOrientations;
}

to the AppDelegate

@pidgy
Copy link

pidgy commented Jan 23, 2019

If you haven't fixed this yet, I was able to get it working by adding the code:

[Export("application:supportedInterfaceOrientationsForWindow:")]    
public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, IntPtr forWindow)
{
     return Plugin.DeviceOrientation.DeviceOrientationImplementation.SupportedInterfaceOrientations;
}

to the AppDelegate

Worked for me

@NebulaSleuth
Copy link

This doesn't work for me in a Xamarin.Forms iOS app on my iPad. Android works fine. The method GetSupportedInterfaceOrientations never gets called. I pulled the repo and tried the sample app and it didn't work either (its not Xamarin.Forms). Is there something incompatible with certain iOS or Xamarin versions? Xamarin.Forms does not expose the ViewController so Not sure it that is related.

@wcoder wcoder added the iOS label May 22, 2020
@udayaugustin
Copy link

I faced the same issue on the iPad. In iPad we need to disable the split-screen feature, to lock the orientation. Set RequireFullScreen to in the Xamarin.iOS info.plist file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants