didReceiveMemoryWarning 没有被调用——UITabBarViewController 应用程序
我的应用程序是一个基于选项卡栏的应用程序,其中包含 6 个选项卡。当我收到内存警告时,除了 1 个视图控制器之外,所有 5 个视图控制器 didReceiveMemoryWarning
方法都会被调用。因此,我在该视图控制器中注册了 UIApplicationDidReceiveMemoryWarningNotification,如下所示:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveMemoryWarning)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
但是,不会调用该视图控制器的 didReceiveMemoryWarning
方法。我错过了什么吗?
My application is a tab bar based applcation including 6 tabs in it. When I receive a memory warning all 5 view controllers didReceiveMemoryWarning
methods are getting called, except for 1 view controller. So I registered for UIApplicationDidReceiveMemoryWarningNotification in that view controller like this:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveMemoryWarning)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
However, this view controller's didReceiveMemoryWarning
method is not called. Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜想在调用了足够的内存警告方法之后,足够的内存被释放,因此它不再调用其他方法。因为其他正在运行的应用程序可能会调用此方法,也可能不会调用此方法。如果已经发布了足够的数据,它可能不会要求每个人都发布数据。
I guess that after having called enough memory warnng methods, enough memory is freed so it do not call other anymore. As this may be called, or not, for other running apps. It may not call everybody to release data if enough data has already been released.