简体   繁体   English

Xamarin Studio iOS:UIImagePickerController相机,在横向模式下隐藏控件

[英]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. 问题是,如果我以纵向模式旋转iPad,则控件是可见的,但是“拍照”按钮不可触摸。 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. 这是2张屏幕快照,以纵向模式启动相机->按钮,在横向旋转后,控件按预期消失,然后将其旋转回纵向,出现控件,但外观有所不同,并且“拍照”按钮不起作用。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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