我就是不明白这一点:

我如何才能在xcode上“关闭” imagePickerController?
这是打开相机的代码,它可以完美运行。

-(IBAction) startcamera {


imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.allowsEditing = NO;
imagePickerController.showsCameraControls=NO;
imagePickerController.toolbarHidden=YES ;
imagePickerController.wantsFullScreenLayout=YES;
imagePickerController.cameraOverlayView=self.view;
self.imagePickerController.delegate=self;
    [self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];


}

好的,现在,说我想通过单击一个按钮来关闭imagePickerController(意味着不选择任何图像):我应该怎么做?
尝试过:

-(IBAction)closecamera {


[imagePickerController release];
    [imagePickerController dismissModalViewControllerAnimated:YES];


}

但这不起作用!
有什么线索吗?
提前致谢

最佳答案

不要释放imagePickerController两次。
您可以使用[self dismissModalViewControllerAnimated:YES];将其关闭

关于iphone - 如何关闭imagePickerController?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4246718/

10-09 07:11