-1

我正在以这种方式加载 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

4

1 回答 1

0

这是因为 cameraController 没有做演示,self 对象做了。您正在调用 self present 而不是 cameraController

于 2013-09-10T17:14:05.340 回答