3

我在 UIPopoverController 中显示相机的 iOS 6 代码工作正常,但 iOS 不会缩放相机视图。请看下面的图片。任何建议,将不胜感激。

编辑

public class NoRotationUIImagePickerController : UIImagePickerController
{
    public override bool ShouldAutorotate ()
    {
        return false;
    }
}

//place imagePicker into a container so that we can control the size of the popover
container = new UIViewController();
container.ContentSizeForViewInPopover = new SizeF(parentViewController.View.Frame.Width, parentViewController.View.Frame.Height);
container.View.AddSubview(_imagePicker.View);

_popOver = new UIPopoverController (container); 

//If no camera is available, return false and do nothing.
if (IsCameraHardwareAvailable())
{
    _imagePicker.Delegate = new PopUpGalleryPickerDelegate (_popOver, _imageSelected);
    _imagePicker.SourceType = UIImagePickerControllerSourceType.Camera;
    _imagePicker.AllowsEditing = false;             
    _imagePicker.MediaTypes = new string[] {"public.image"};

    RectangleF popRectangle = new RectangleF (new PointF(parentViewController.View.Frame.Width/2, parentViewController.View.Frame.Height/2), new SizeF (1, 1));

    _popOver.PresentFromRect(popRectangle, parentViewController.View, 0, true); 
    _imagePicker.View.Frame = container.View.Frame;  //change to frame must come after popover is presented.
}
else
{
    cameraAvailable = false;
}

iOS 6 视图 iOS 7 视图

4

1 回答 1

1

我最终得到的解决方案是让相机全屏显示,而不是使用弹出式控制器。

于 2013-10-01T00:24:36.953 回答