0

我为我的 UIImagePickerController 创建了 OverlayView。有没有办法重新定位观众出现的位置?目前,查看器被一直推到设备的一侧,黑框填充屏幕的其余部分。

- (IBAction)presentCameraView:(id)sender {

_picker = [[UIImagePickerController alloc] init];
_picker.sourceType = UIImagePickerControllerSourceTypeCamera;

// Set flag to allow the alert to be shown
_showAlert = YES;
_endAlerts = NO;

_overlay = [[[NSBundle mainBundle] loadNibNamed:@"CameraOverlay" owner:self options:nil] objectAtIndex:0];
_picker.delegate = self;
_picker.wantsFullScreenLayout = YES;
_picker.allowsEditing = NO;
_picker.cameraOverlayView = _overlay;
_picker.showsCameraControls = NO;
[self presentViewController:_picker animated:YES completion:NULL];
}

在此处输入图像描述

在此处输入图像描述

4

1 回答 1

1

所以,在看了很多之后,我终于找到了一些东西,可以让我重新定位相机视图以及改变它的大小。

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 71.0); 
//This slots the preview exactly in the middle of the screen by moving it down 71 points

CGAffineTransform scale = CGAffineTransformScale(translate, 0.8888889, 1);
//This scales the view to the size that you want it.

_picker.cameraViewTransform = scale;
于 2014-03-11T17:25:35.447 回答