收到内存警告。显示UIImagePickerController时Level = 1 [英] Received memory warning. Level=1 when showing a UIImagePickerController

查看:155
本文介绍了收到内存警告。显示UIImagePickerController时Level = 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我发疯了!!!

每当我尝试使用sourceType显示UIImagePickerController时,我收到收到内存警告。等级= 1 = UIImagePickerControllerSourceTypeCamera。

I'm getting a "Received memory warning. Level=1" whenever I attempt to show a UIImagePickerController with a sourceType = UIImagePickerControllerSourceTypeCamera.

以下是我在viewDidLoad中设置的代码:

Here is the code from my viewDidLoad where I set things up:

    - (void)viewDidLoad {

    [super viewDidLoad];

    // Set card table green felt background
    self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"green_felt_bg.jpg"]];


    // Init UIImagePickerController
    // Instantiate a UIImagePickerController for use throughout app and set delegate
    self.playerImagePicker = [[UIImagePickerController alloc] init];
    self.playerImagePicker.delegate = self;
    self.playerImagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
}

以下是我以模态方式呈现的方式..

And here is how I present it modally ..

- (IBAction) addPlayers: (id)sender{
[self presentModalViewController:self.playerImagePicker animated:YES];

}

结果...... UIImagePicker开始显示然后繁荣......我得到了内存警告......每一次!有趣的是,如果我切换到sourceType = UIImagePickerControllerSourceTypePhotoLibrary ......一切正常。

The result ... UIImagePicker starts to show and then boom ... I get the memory warning ... EVERY TIME! Interestingly enough, if I switch to sourceType = UIImagePickerControllerSourceTypePhotoLibrary ... everything works fine.

我错过了什么或做错了什么?我想做的就是显示相机,拍摄并保存图片。

What in the heck am I missing or doing wrong? All I want to do is show the camera, take and save a picture.

仅供参考 - 我正在测试我的3GS设备。

FYI - I'm testing on my 3GS device.

感谢任何可以提供帮助的人:)

Thanks to anyone who can help :)

推荐答案

这是非常常见。只要您处理内存警告而不会崩溃并且有足够的空间继续运行,请不要让它让您发疯。

This is very common. As long as you handle the memory warning without crashing and have enough space to keep going, don't let it drive you crazy.

这篇关于收到内存警告。显示UIImagePickerController时Level = 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆