iphone - iPhone如何从UIWebView访问相机?

标签 iphone objective-c ios ios5 cordova

Possible Duplicate:
access camera from uiwebview?

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;      
picker.allowsImageEditing = YES;      
picker.sourceType = UIImagePickerControllerSourceTypeCamera;       
[self presentModalViewController:picker animated:YES];
 return  NO;

我正在使用上面的编码,但是没有用..

如何从WebView打开相机
任何人都可以帮助我。

谢谢

最佳答案

试试这个:

UIImagePickerController  *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.allowsImageEditing = YES;
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imgPicker animated:YES];
[imgPicker release];

下面是委托方法:
#pragma mark UIImagePickerController delegate
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // Access the uncropped image from info dictionary
    UIImage *imgCapturePhoto = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    [self dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *) picker
{
    [picker dismissModalViewControllerAnimated:YES];
}

快乐编码...

关于iphone - iPhone如何从UIWebView访问相机? ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10719016/

相关文章:

objective-c - MKStoreKit 中的 "No visible @interface for ' NSData ' declares the selector ' base64EncodedString"错误

ios - 如何将 iOS 应用程序中创建的文件传输到 Mac

ios - 在 UITableViewCell 中模糊图像时出现性能问题

iphone - 如何从缓冲区而不是音频文件中获取耳机插孔音频?

ios - 如何向导航项添加按钮?

iphone - 应用程序加载器错误消息 (iPhone)

iphone - setIndentationLevel 不适用于 cell.ContentView subview

iphone - NSMutableArray 到 NSDictionary iOS 3.1.3 问题

ios - ios中AudioUnitRender()函数返回的音频数据的最大值是多少

objective-c - SMJobRemove 成功,但未删除 plist 和 helper 工具