3
我正在使用UIImagepickerController从相机拍摄照片..我通过使用cameraoverlayview属性在相机视图上使用我自己的视图...我想在用户单击自定义视图中的按钮时从相机拍摄照片。 ..我现在用的是下面的代码使用UIImagepickerController cameraoverlayview拍照?
- (void)viewDidLoad {
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePickerController animated:YES];
imagePickerController.showsCameraControls=NO;
imagePickerController.cameraOverlayView = self.customView;
}
- (IBAction) takePicture
{
[imagePickerController takePicture];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissModalViewControllerAnimated:YES];
}
但是当我运行这段代码它给我的错误
ERROR: FigCreateCGImageFromJPEG returned -12905. Input (null) was 773625 bytes.
,我也得到了内存使用2级警告,然后平1
没有图像是d显示在imageView ..任何人都可以帮助我,我可能会做错什么? 顺便说一句我使用的iPhone 3G上安装的iOS4.1
不确定,但看看UIImage与UIImageView。我怀疑它可能与你的'[objectforKey:...]'调用有关。 – Moshe 2010-11-10 05:29:19
其实didFinishPickingMediaWithInfo甚至没有被调用..我已经包括它的代表 – hemant 2010-11-10 06:40:32