简体   繁体   中英

UIImagePickerController dismiss doesn't work on iPhone 5S

I am using the UIImagePickerController to take a picture on an iPhone 5S. I can present it alright as a modal with

[self.navigationController presentViewController:picker animated:YES completion:^{}];

But when I want to dismiss it in the delegate methods it doesn't work. And the memory builds up memory up 300 MB (before that it was at 25 MB). I dismiss it like this :

[picker dismissViewControllerAnimated:NO completion:^{}];

The code works fine on iPhone 5.

Here is how I initialize it :

UIImagePickerController* picker = [[UIImagePickerController alloc] init]; picker.sourceType = UIImagePickerControllerSourceTypeCamera; picker.modalPresentationStyle = UIModalPresentationCurrentContext; picker.delegate = self; picker.allowsEditing = NO; [self.navigationController presentViewController:picker animated:YES completion:^{}];

如果您没有完成处理程序,请传入nil而不是^ {}。

[picker dismissViewControllerAnimated:NO completion:nil];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM