iphone - 如何关闭uiimagePickerController?

标签 iphone xcode uiimagepickercontroller dismiss

我就是听不懂:

到底如何才能在 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. 不要释放 uiimagePickerController 两次。
  2. 您可以使用 [selfmissViewControllerAnimated:YES];
  3. 关闭它

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

相关文章:

iphone - 如何逐步显示 UIImageView

iphone - 当 objective-c 中出现推送通知时,如何在没有用户交互的情况下将 iphone 应用程序从后台带到前台?

swift - 使用swift通过图像选择器选择后如何镜像图像?

swift - 从 ReferenceURL : fetchAssets(withALAssetURLs:options:) DEPRECATED 获取 PHAsset

ios - 当前位置的蓝点未使用适用于 iOS 的谷歌地图显示

iphone - AVAudioPlayer 不会在 15 次中播放一次音频

iphone - 减少应用程序大小超过50兆的最佳方法

ios - 每次进行更改时预览都会出错 (SwiftUI)

ios - 一个配置文件超过一个团队

ios - Swift 3 相机无法保存