我正在使用UIImagePickerController创建自定义相机控件。我遇到的问题是:
当用户拍照时,我想展示他们拍摄的照片的预览。我已经设法通过在相机取景器上显示UIImageView来做到这一点。唯一的问题是在显示图像视图之前存在可见的延迟。有任何想法吗?我的代码如下所示
- (void)viewDidLoad
{
[super viewDidLoad];
picker = [[UIImagePickerController alloc] init];
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
overlayViewController = [[CameraOverlayViewController alloc] initWithNibName:nil bundle:nil];
[picker setCameraOverlayView:overlayViewController.view];
[picker setShowsCameraControls:NO];
[picker setDelegate:self];
[self.view addSubview:picker.view];
}
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
[overlayViewController.imgView setImage:img];
[overlayViewController.imgView setHidden:NO];
return;
}
答案 0 :(得分:1)
UIImagePickerController是UINavigationController的子类。您可以创建自定义预览视图控制器(只是包含图像视图和取消和使用按钮的视图控制器)并将其推送到图像选择器控制器上。