0 iphone objective-c ios-simulator
我看到一些应用程序在检测到内存不足时会生成警告.我尝试在我的应用程序中执行此操作但遇到了问题.使用模拟器模拟内存警告,生成的警报会弹出两次,然后才能点击"确定"并在该时间之后突然再次弹出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];
}
Run Code Online (Sandbox Code Playgroud)
谢谢,
菲尔
Mik*_*ike 12
一般来说,您不应该通知用户内存不足.毕竟,他们能做什么?您的应用程序是前台应用程序,除了Apple应用程序之外,它正在消耗设备的大部分内存.用户看到内存消息时要做什么?
当您收到内存不足通知时,您应该专注于释放内存,而无需用户交互.
| 归档时间: |
|
| 查看次数: |
1166 次 |
| 最近记录: |