很明显,有些人已经能够弄清楚如何通过SDK(例如Spore Origins)访问iPhone相机.如何才能做到这一点?
您需要使用UIImagePickerController
该类,基本上:
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = pickerDelegate picker.sourceType = UIImagePickerControllerSourceTypeCamera
pickerDelegate
上面的对象需要实现以下方法:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
字典info
将包含原始条目和编辑后的图像,分别用UIImagePickerControllerOriginalImage
和键入UIImagePickerControllerEditedImage
.(有关详细信息,请参阅https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegate和https://developer.apple.com/documentation/uikit/uiimagepickercontrollerinfokey)
嗯.....曾经尝试使用OverlayView?有了这个,相机可能看起来定制,但实际上它只是它上面的一个视图.
如果直接访问私有API,则可能导致Apple拒绝该应用.看看以下链接是否有帮助.
链接文字