在UIImagePickerController中隐藏loggingbutton
我有一个关于UIImagePickerController的问题。 我可以使用UIImagePickerController作为预览吗? 如果我这样做,我必须隐藏loggingbutton,有没有办法做到这一点? 或任何其他方法来显示除UIImagePickerController以外的预览。
感谢您的帮助…
您可以使用以下命令来隐藏UIImagePickerController
的控件:
[myImagePickerController setShowsCameraControls:NO];
编辑:看看这个代码,它隐藏图像select器内的所有控件,让您创build并添加自己的自定义控件。 不幸的是,你不能有select地隐藏select器内的控件,所以这是另一种select。
- (void)showCamera { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { myImagePicker = [[UIImagePickerController alloc] init]; [myImagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; [myImagePicker setDelegate:self]; [myImagePicker setShowsCameraControls:NO]; UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; UIButton *switchCameraButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [switchCameraButton setFrame:CGRectMake(10, 430, 72, 40)]; [switchCameraButton addTarget:self action:@selector(changeCamera:) forControlEvents:UIControlEventTouchUpInside]; [overlayView addSubview:switchCameraButton]; [myImagePicker setCameraOverlayView:overlayView]; [self presentViewController:myImagePicker animated:YES completion:nil]; } } - (IBAction)changeCamera:(id)sender { if (myImagePicker.cameraDevice == UIImagePickerControllerCameraDeviceFront) { [myImagePicker setCameraDevice:UIImagePickerControllerCameraDeviceRear]; }else{ [myImagePicker setCameraDevice:UIImagePickerControllerCameraDeviceFront]; } }