didReceiveMemoryWarning 没有被调用——UITabBarViewController 应用程序

发布于 2024-12-14 02:02:10 字数 599 浏览 0 评论 0原文

我的应用程序是一个基于选项卡栏的应用程序,其中包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城月光淡如水﹏ 2024-12-21 02:02:10

我猜想在调用了足够的内存警告方法之后,足够的内存被释放,因此它不再调用其他方法。因为其他正在运行的应用程序可能会调用此方法,也可能不会调用此方法。如果已经发布了足够的数据,它可能不会要求每个人都发布数据。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文