How to lock orientation in landscape for an iPad only app.

JoeRacoJoeRaco USMember
edited September 2016 in Xamarin.iOS

Hello everyone, any help is appreciated going crazy here. I've done some research and am aware of the methods that need to be overridden such as.

            public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
        {
            return toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight;
        }

        public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
        {
            return UIInterfaceOrientationMask.LandscapeRight;
        }

        public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
        {
            return UIInterfaceOrientation.LandscapeRight;
        }

        public override bool ShouldAutorotate()
        {
            return true;
        }

However, these only get called when I set the devices to iPhone/iPod in the info.plist section. Once I select iPad, the methods above never get called and therefore stays in portrait mode, any ideas, really hoping someone can help with this, thanks in advance? Here is a screen shot of my info.plist.

Answers

  • JoeRacoJoeRaco USMember

    Anybody?? Still having this issue...

  • JoeRacoJoeRaco USMember

    Phew. Finally figured it out. So it turns out checking the 'Requires full screen' to on in the info.plist section triggers all the methods above to be fired and therefore locking the orientation. Without this none of the methods will be called. These are the moments when I debate heavily on whether to cheer and scream my lungs out or to cry my eyes out and weep that a single checkbox took hours of my life away. Why Apple?............................WHY!!!!!!!!!!!!

    Well, here is a screen shot of the info.plist just in case this helps some poor fellow in the future. And also the stack post that indirectly solved it.

    http://stackoverflow.com/questions/32728711/xcode-7-error-itms-90474-invalid-bundle-cant-submit-to-apple

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    The trouble with doing that is that it opts out of multitasking features. Apple doesn't want you to do that, so they're sure not going to make it easy or obvious for you :wink:

Sign In or Register to comment.