0

在我的 iPad 应用程序中,我试图在 UIPopOverController 中打开前置摄像头。它的行为很奇怪。当我第一次单击按钮打开摄像头时,它打开前置摄像头,第二次打开后置摄像头,同样重复。一次前置摄像头和第二次后置摄像头。虽然我也将前置摄像头设置为摄像头设备。这是我的代码,请帮忙。

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];
4

1 回答 1

1

我自己得到了答案。我没有发布 imagePickerController。释放它后,我每次都会得到前置摄像头。;)

于 2013-03-19T09:22:37.207 回答