我正在尝试将摄像头用于我的应用程序,但问题是当我使用此代码时,前置摄像头已禁用:
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];
}
最佳答案
我使用此代码,它使我可以完美切换相机:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
关于iphone - 如何启用iPhone相机按钮(缩放,闪光灯,开关),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5762953/