wcoder / Xamarin.Plugin.DeviceOrientation

Cross-platform plugin to work with screen orientation of mobile device.
MIT License
61 stars 19 forks source link

Lock Orientation not working in xamarin forms #3

Closed arjun159 closed 6 years ago

arjun159 commented 6 years ago

When using the lockorientation to portrait in xamarin forms even then the screen is rotating to the landscape mode.

wcoder commented 6 years ago

Could you please clarify for Android / iOS / UWP?

gmwilhelm commented 6 years ago

I see this too, on iOS

wcoder commented 6 years ago

Do you use the code for iOS Specific Support? https://github.com/wcoder/Xamarin.Plugin.DeviceOrientation#ios-specific-support

gmwilhelm commented 6 years ago

I don't have a ViewController in Xamarin.Forms on iOS.

I'm trying like this in my code-behind of my xaml page:

 public partial class MyLockedPage : ContentPage
    {
        public MyLockedPage ()
        {
            InitializeComponent();
            CrossDeviceOrientation.Current.LockOrientation(Plugin.DeviceOrientation.Abstractions.DeviceOrientations.Portrait);
        }
    }
wcoder commented 6 years ago

Ok, I will check and report results in the near time.

wcoder commented 6 years ago

@arjun159, @gmwilhelm please check version 1.0.5.

For Xamarin.Forms iOS look at this: https://github.com/wcoder/Xamarin.Plugin.DeviceOrientation#xamarinforms-ios

gmwilhelm commented 6 years ago

Thanks, works for me

darrenmcgrath commented 6 years ago

For me on iOS I had to manually edit the Info.plist as the Manifest editor was not updating it correctly See below for locking iphone and ipad to portrait

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
vhugogarcia commented 2 years ago

Thanks @darrenmcgrath the info.plist solution worked very good.

ravi-simrun commented 2 years ago

we are facing a weird issue with xamarin forms ios orientation.

while implementing the xamarin community toolkit we are facing the orientation issue in ios.

In android, it is working fine but in ios the tool kit tab view is messed up.

Any solution?

wcoder commented 2 years ago

@ravi-simrun could you please provide more info?

ravi-simrun commented 2 years ago

ya sure please find the attached screenshots Xamarin.Forms version 5.0.0.2196 Xamarin community toolkit version [1.3.1] IMG_0034 IMG_0035 IMG_0036

wcoder commented 2 years ago

@ravi-simrun thanks for the details could you please describe the issue? (screenshots are not so clear) code samples?