Xamarin Studio iOS:UIImagePickerController Camera,以横向模式隐藏控件

时间:2015-01-27 11:29:38

标签: c# ios ipad xamarin.ios xamarin

我想只允许在纵向模式下拍照。 我的想法是在横向模式下隐藏控件。 问题是,如果我在纵向模式下旋转iPad,控件是可见的,但拍摄照片按钮是不可触摸的。有什么想法吗?

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;
    }

1 个答案:

答案 0 :(得分:0)

以下是2个截图,以纵向模式启动相机 - >按钮工作,在横向旋转后,控制按预期消失,然后将其旋转回肖像,控件出现,但看起来不同,拍摄照片按钮不起作用。

enter image description here enter image description here