Iphone 如何从 UIWebView 访问相机? [复制]
Posted
技术标签:
【中文标题】Iphone 如何从 UIWebView 访问相机? [复制]【英文标题】:Iphone How to access camera from UIWebView? [duplicate] 【发布时间】:2012-05-23 11:30:20 【问题描述】:可能重复: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 打开相机 任何人帮助我。
谢谢
【问题讨论】:
【参考方案1】:试试这个:
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];
快乐编码...
【讨论】:
从 html 页面我按下它来到 .m 文件的按钮,所以我们正在使用 uiwebview 所以上面的编码只有我们使用 uiview 才有用.. 看到这篇文章我问这样***.com/questions/2915881/… 但我试过那个样品我得到空页相机没有打开..有什么想法吗?以上是关于Iphone 如何从 UIWebView 访问相机? [复制]的主要内容,如果未能解决你的问题,请参考以下文章
如何从 UIWebView 在 iPhone 上创建 .webarchive 文件?
您可以从 Mobile Safari 访问 iPhone 相机吗? [关闭]
如何在没有相机接口的情况下访问 iPhone 相机 API?