UIImagePickerController takePicture

时间:2011-11-29 13:59:00

标签: iphone objective-c

我想使用UIImagePickerController takePicture方法。 问题是他的UIImagePickerController没有显示在屏幕上,用户无法按下使用按钮来接受img。 有没有办法跳过这个屏幕直接进入:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 

用于保存图像?

1 个答案:

答案 0 :(得分:1)

我发现这样做的唯一方法是为UIImagePickerController使用自定义叠加层。你可以使用类似于下面的代码来做到这一点:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;

//create custom overlay and allocate it as "customOverlayView"
picker.cameraOverlayView = customOverlayView;

//do any other setup desired for picker

[self presentViewController:picker animated:YES completion:nil];
[picker release];

现在一旦调用了takePicture方法,就会立即调用委托didFinishPickingMediaWithInfo:。