我正在以这种方式加载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
答案 0 :(得分:0)
这是因为cameraController没有做演示,自我对象做了。你正在调用self present而不是cameraController