在iOS7中,内置相机应用在拍照后不会进入预览界面,有没有办法让UIImagePicker表现得像这样。
我知道另一种解决方案是使用AVFoundation类创建自定义相机,但这超出了我的知识范围,而且我真的很喜欢默认相机的外观。
更新
所以经过更多的研究,我发现我可以创建自己的快门按钮并将其设置为相机叠加层。这是我做的。
对于“shootPicture”方法:
如果我只让选择器调用'takePicture',我仍然会看到预览,因此我强制选择器在拍照后立即调用didFinishPickingMediaWithInfo。结果是我不再看到预览屏幕,但我也看不到照片。我知道我在didFinishPickingMediaWithInfo中放了“nil”,因为此时我不知道该放什么。我也知道它拍了一张照片并在缓存中,但我真的不知道该如何获取它。任何想法将不胜感激=)
UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
我知道另一种解决方案是使用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];
对于“shootPicture”方法:
- (void) shootPicture
{
[picker takePicture];
[self imagePickerController:self.camCtl didFinishPickingMediaWithInfo:nil];
}
如果我只让选择器调用'takePicture',我仍然会看到预览,因此我强制选择器在拍照后立即调用didFinishPickingMediaWithInfo。结果是我不再看到预览屏幕,但我也看不到照片。我知道我在didFinishPickingMediaWithInfo中放了“nil”,因为此时我不知道该放什么。我也知道它拍了一张照片并在缓存中,但我真的不知道该如何获取它。任何想法将不胜感激=)