我正在尝试将相机用于我的应用程序,但问题是当我使用此代码时前置相机被禁用:
ipc.cameraDevice = UIImagePickerControllerCameraDeviceRear;
反之亦然!
ipc.cameraDevice = UIImagePickerControllerCameraDeviceFront;
如何将它们组合在一起?我的意思是启用开关按钮使用前后摄像头,!!!所有按钮都被禁用!变焦,闪光灯,相机开关
代码:
-(IBAction)takePic {
USImage.hidden = YES;
ipc = [[UIImagePickerController alloc]init];
ipc.delegate = self;
ipc.sourceType = UIImagePickerControllerSourceTypeCamera;
ipc.cameraDevice = UIImagePickerControllerCameraCaptureModePhoto;
ipc.cameraViewTransform = YES;
[self presentModalViewController:ipc animated:YES];
}
答案 0 :(得分:2)
我使用此代码,它让我可以完美地切换相机:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
答案 1 :(得分:0)
你不能同时使用它们
答案 2 :(得分:0)
只是不要同时提供这两行;)。如果你没有设置cameraDevice,那么你的ImagePickerController上会显示按钮(并且像魅力一样工作)