gpt4 book ai didi

iphone - 如何关闭imagePickerController?

转载 作者:行者123 更新时间:2023-12-03 20:47:40 27 4
gpt4 key购买 nike

我就是听不懂:

到底如何才能在 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];

}

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

最佳答案

  1. 不要释放 imagePickerController 两次。
  2. 您可以使用 [selfmissModalViewControllerAnimated:YES];
  3. 关闭它

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com