【发布时间】:2010-12-31 20:33:26
【问题描述】:
我看到一些应用程序在检测到内存不足时会生成警告。我试图在我的应用程序中执行此操作,但遇到了问题。使用模拟器模拟内存警告,生成的警报在我可以点击“确定”之前弹出两次,然后再弹出 9 次才最终消失。
在调用 didReceiveMemoryWarning 时生成警报是不是一个坏主意?
如果没有,有没有比我下面的方法更好的方法?
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
...
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Warning"
message:@"Your device is low on memory..."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
谢谢,
菲尔
【问题讨论】:
标签: iphone objective-c ios-simulator