简体   繁体   English

它是如何工作的针对iOS 6的ReceiveMemoryWarning

[英]How it works didReceiveMemoryWarning for iOS 6

I don't know too much information about didReceiveMemoryWarning but considering what I read on other posts and looking for in the documentation, I've seen that in case of iOS 5, any non-visible view controller will dump its view, but in case of iOS 6 the documention ( documentation says that the default implementation "exits" and I don't know exactly how I should understand that. 我不知道关于didReceiveMemoryWarning太多信息,但是考虑到我在其他文章上阅读的内容以及在文档中寻找的内容,我已经看到在iOS 5的情况下,任何不可见的视图控制器都会转储其视图,但是关于iOS 6的文档( 文档说默认实现“退出”,我不知道该怎么理解。)

I've been doing some tests with the iOS Simulator simulating a low-memory warning, and I appreciate (on iOS 5) that in case I am in a 2nd view on the stack and I simulate a low-memory warning, nothing happens with the present view but if i go back to the previous view was released and the viewDidLoad is called again as I expected, however in case of iOS 6 none of the previous views was released, what I mean with this and this is my question: What are the consequences of a didReceiveMemoryWarning on iOS 6 if the views are not released, should I be worried for anything else that I'm not considering? 我一直在使用iOS Simulator进行一些测试,以模拟低内存警告,并且感谢(在iOS 5上)如果我在堆栈的第二视图中并且模拟了低内存警告,则不会发生任何情况当前视图,但是如果我返回上一个视图,并且按预期的那样再次调用viewDidLoad,但是在iOS 6的情况下,以前的视图都没有发布,这是我的意思,这是我的问题:如果未发布视图,iOS 6上的didReceiveMemoryWarning的后果是什么,我是否还要担心我没有考虑的其他事项? Even though the views are not released things like the class variables (NSMutableArray for example) could be deallocated? 即使未发布视图,也可以释放诸如类变量(例如NSMutableArray)之类的东西?

You only have more control as views are no longer purged under low-memory conditions and so this method [viewDidUnload] is never called ( Deprecated UIViewController Methods ). 您仅拥有更多控制权,因为views are no longer purged under low-memory conditions and so this method [viewDidUnload] is never called不推荐使用的UIViewController方法 )。

If the view is something expensive to build but not as hungry for memory , you'll probably not release it. 如果视图的构建成本很高,但又不占用内存,则可能不会释放它。 As far as I know iOs won't release anything in case of memory warning, the decision is completely up to you, use didReceiveMemoryWarning or other notification techniques (see the section Observe Low-Memory Warnings ). 据我所知,如果出现内存警告,iO不会释放任何内容,那么决定完全取决于您,使用didReceiveMemoryWarning或其他通知技术(请参阅观察内存不足警告一节 )。

WWDC 2012 Session 236: The Evolution of View Controllers on iOS might be interesting for you. WWDC 2012会议236:iOS上视图控制器的演变可能对您很有趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM