Tre*_*sen 5 iphone objective-c uiimagepickercontroller
我希望我的应用程序只使用前置摄像头.所以我已经实现了以下代码.
if ([UIImagePickerControllerisCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]) {
self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}
Run Code Online (Sandbox Code Playgroud)
这是我第一次打开相机时(它使用前置摄像头).但如果我取消照片然后重新进入相机,它将使用后置摄像头.
每次取消/重新进入相机时,它会在前后摄像头之间切换......
有什么我想念的吗?
小智 0
Tr this code .I used this code and it is working fine .Use this code either in button action or viewwillappear or viewdidload and dismiss the camera view properly
imgPicker =[[UIImagePickerController alloc] init];
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imgPicker.cameraDevice=UIImagePickerControllerCameraDeviceFront;
imgPicker.showsCameraControls = YES;
imgPicker.allowsEditing = YES;
imgPicker.delegate=self;
[self presentViewController:imgPicker
animated:NO completion:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
181 次 |
| 最近记录: |