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