我正在以这种方式加载 UIImagePickerController:
- (void) launchCamera {
// Set up the camera
CustomCamera *cameraController = [[CustomCamera alloc] init];
cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraController.delegate = self;
cameraController.showsCameraControls = NO;
cameraController.navigationBarHidden = YES;
cameraController.toolbarHidden = YES;
// overlay on top of camera lens view
UIImageView *cameraOverlayView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"camera_overlay.png"]];
cameraOverlayView.alpha = 0.0f;
cameraController.cameraOverlayView = cameraOverlayView;
// animate the fade in after the shutter opens
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:2.2f];
cameraOverlayView.alpha = 1.0f;
[UIView commitAnimations];
[self presentModalViewController:cameraController animated:YES];
}
问题是我不知道如何解雇它。当我尝试
[cameraController dismissViewControllerAnimated:YES completion: nil];
我收到一个红色错误。cameraController 只是一个 UIImagePickerController