如何在使用UIImagePickerController Camera时禁用"预览"屏幕

Pau*_*ith 5 camera overlay preview uiimagepickercontroller ios7

在iOS7中,内置相机应用程序在拍照后没有进入预览屏幕,UIImagePicker是否有任何表现方式.

UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
Run Code Online (Sandbox Code Playgroud)

我知道另一个解决方案是使用AVFoundation类创建一个自定义相机,但这是我不知道的,我真的很喜欢默认相机的外观.

更新

经过一些研究后我发现我可以创建自己的快门按钮并将其设置为相机覆盖.这就是我做的

UIButton *shutter = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[shutter addTarget:self action:@selector(shootPicture) forControlEvents:UIControlEventTouchUpInside];
[shutter setTitle:@"S" forState:UIControlStateNormal];
shutter.frame = CGRectMake(50, 50, 60, 60);

UIView *layoutView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
layoutView.opaque = NO;
layoutView.backgroundColor = [UIColor clearColor];
[layoutView addSubview:shutter];
Run Code Online (Sandbox Code Playgroud)

对于'shootPicture'方法

- (void) shootPicture
{
   [picker takePicture];
   [self imagePickerController:self.camCtl didFinishPickingMediaWithInfo:nil];
}
Run Code Online (Sandbox Code Playgroud)

如果我只是让选择器调用'takePicture',我仍然会得到预览,所以我强迫选择器在拍照后立即调用didFinishPickingMediaWithInfo.结果是我没有看到预览屏幕但是我也看不到图片.我知道我把'nil'放在didFinishPickingMediaWithInfo中因为我不知道在这一点上放什么.我也知道它在某个地方的缓存中拍了一张照片,但我真的不知道如何获得它.

任何想法将不胜感激=)

小智 0

这个解决方案对我有用:

self.pickerController.allowsEditing = false
Run Code Online (Sandbox Code Playgroud)