使用 iOS 访问相机 [英] Access the camera with iOS

查看:19
本文介绍了使用 iOS 访问相机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很明显,有些人已经能够弄清楚如何通过 SDK 访问 iPhone 摄像头(例如 Spore Origins).如何做到这一点?

It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example). How can this be done?

推荐答案

需要用到UIImagePickerController类,基本上:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = pickerDelegate
picker.sourceType = UIImagePickerControllerSourceTypeCamera

上面的pickerDelegate对象需要实现如下方法:

The pickerDelegate object above needs to implement the following method:

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

字典 info 将包含原始图像和编辑图像的条目,分别以 UIImagePickerControllerOriginalImageUIImagePickerControllerEditedImage 为键.(请参阅 https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegatehttps://developer.apple.com/documentation/uikit/uiimagepickercontrollerinfokey 了解更多详情)

The dictionary info will contain entries for the original, and the edited image, keyed with UIImagePickerControllerOriginalImage and UIImagePickerControllerEditedImage respectively. (see https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegate and https://developer.apple.com/documentation/uikit/uiimagepickercontrollerinfokey for more details)

这篇关于使用 iOS 访问相机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆