HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 关闭UIImagePickerController大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经尝试了解除UI ImagePickerController的所有变化,但没有运气.我究竟做错了什么.

- (IBAction)choosePhoto
{
    self.picker = [[UIImagePickerController alloc] init];
    self.picker.delegate = self;
    self.picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:self.picker animated:YES];

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)imagePicker
{
    NSLog(@"dismiss image picker");
    [self dismissModalViewControllerAnimated:NO];
    [[self.picker parentViewController] dismissModalViewControllerAnimated:NO];
    [self.presentedViewController dismissModalViewControllerAnimated:NO];
    [self.presentingViewController dismissModalViewControllerAnimated:NO];
     // And every other way i Could think of
}

- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    .. same stuff here
}

我试图从父,祖父母,navigationController和根控制器呈现选择器,没有任何作用.我做什么我不能解雇ImagePickerController.

请注意每次都会调用log语句.

干杯

解决方法

试试这一行.它可能适合你.

[self.picker dismissModalViewControllerAnimated:NO];

对于iOS 6及更高版本,请使用此功能

[self.picker dismissViewControllerAnimated:NO completion:nil];

也可以使用此代码显示您的选择器控制器

if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
    [self presentViewController:self.picker animated:YES completion:nil];
} else {
    //To target iOS 5.0
    [self presentModalViewController:self.picker animated:YES];
}

大佬总结

以上是大佬教程为你收集整理的ios – 关闭UIImagePickerController全部内容,希望文章能够帮你解决ios – 关闭UIImagePickerController所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: