在我的iPad应用程序中,我试图在UIPopOverController中打开前置摄像头。它表现得很奇怪。当我第一次点击按钮打开摄像头时,它打开前置摄像头,第二次再次打开后置摄像头repeat.once前置摄像头和第二次后置摄像头。虽然我也将前置摄像头设置为摄像头设备。这是我的代码,请帮忙。
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
[imagePickerController setCameraCaptureMode:UIImagePickerControllerCameraCaptureModePhoto];
[imagePickerController setCameraDevice:UIImagePickerControllerCameraDeviceFront];
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
答案 0 :(得分:1)
我得到了自己的回答。我没有发布imagePickerController。 释放后我每次都会得到前置摄像头。 ;)