简体   繁体   中英

Xamarin Studio iOS: UIImagePickerController Camera, Hide controls in landscape mode

I want to allow taking a photo only in portrait mode. My idea is to hide the controls in landscape mode. The problem is, if I rotate the iPad in portrait mode, the controls are visibel, but the take photo button is not touchable. Any ideas?

public override bool ShouldAutorotate ()
{
        Console.WriteLine (UIDevice.CurrentDevice.Orientation);

        switch (UIDevice.CurrentDevice.Orientation) {

        case UIDeviceOrientation.LandscapeLeft:
        case UIDeviceOrientation.LandscapeRight:
            this.ShowsCameraControls = false;
            this.AllowsEditing = false;
            break;
        case UIDeviceOrientation.Portrait:
        case UIDeviceOrientation.PortraitUpsideDown:
            this.ShowsCameraControls = true;
            this.AllowsEditing = true;


            break;
        }

        return true;
    }

Here are 2 screenshots, starting camera in portrait mode-> Button working, after rotating in landscape, controls disappearing as expected, then rotating it back to portrait, the controls appearing, but looking different and the take photo button is not working.

在此处输入图片说明在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM