0

我试图在我的 OverlayViewController 中将 UIImagePickerController 的框架设置为屏幕的中间 - 我创建自定义按钮的地方:

self.imagePickerController.showsCameraControls = NO;
if ([[self.imagePickerController.cameraOverlayView subviews] count] ==0)
{
   CGRect overlayViewFrame = self.imagePickerController.cameraOverlayView.frame;
   CGRect newFrame = CGRectMake(0.0, CGRectGetHeight(overlayViewFrame)-self.view.frame.size.height-10.0, CGRectGetWidth(overlayViewFrame), self.view.frame.size.height + 10.0);
   self.view.frame = newFrame;
   [self.imagePickerController.cameraOverlayView addSubview:self.view];
   CGRect imagePickerControllerFrame = CGRectMake(0, topPanel.frame.size.height + 50, self.view.frame.size.width, self.view.frame.size.height - topPanel.frame.size.height - bottomPanel.frame.size.height);
   self.imagePickerController.view.frame = imagePickerControllerFrame;
}

但是,它会全屏打开,并且所选图像包括顶部和底部面板下方的区域。我希望它是一个矩形。

UIImagePickerController从代表视图中呈现如下:

[self presentViewController:self.overlayViewController.imagePickerController animated:YES completion:nil];

怎么了?

4

1 回答 1

0

来自UIViewController参考(链接):

presentViewController:动画:完成:

讨论

在 iPhone 和 iPod touch 上,呈现的视图总是全屏

如果要嵌入图像选择器,则应手动将其视图添加到其他视图之一。

于 2013-01-17T17:25:10.677 回答