问题描述
我注意到,当我加载UIImagePickerController并为其拍照时,会调用didReceiveMemoryWarning
.另外,在Instruments中,存在大量内存泄漏(我发誓,不是我本人!).我听说这是UIImagePickerController的问题,但是我不确定如何解决它.这是我对UIImagePickerController的实现.
I've noticed that when I load a UIImagePickerController and I take a picture with it, didReceiveMemoryWarning
is called. Also, in Instruments, there is a significant memory leak (not by me, I swear!). I've heard that this is a problem with UIImagePickerController but, I'm not sure how to fix it. Here is my implementation of UIImagePickerController.
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; // Create the imagePicker
imagePicker.delegate = self;
imagePicker.allowsEditing = YES; // Allow editing of the images
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
有什么想法吗?我真的不想牺牲这种有用的功能.
Any ideas? I really don't want to sacrifice such a useful feature.
推荐答案
您需要将图像重新缩放为较小的尺寸,例如320x460.然后它将成功运行.
You need to rescale the image to a smaller size, say 320x460. Then it will run successfully.
这篇关于使用Camera的UIImagePickerController的严重内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!