English 中文(简体)
使用 ARC 时何时将对象设定为零?
原标题:When set objects to nil when using ARC?

Im 使用 ARC 在一个 iPhone 项目上的 iPhone 。 应用程序是一个基于导航的应用程序, 使用 < code>UINAvigationcurrent 。

典型的使用实例是从“main”UIViewcurrent”到“second”,多次,可能多达100次。二级控制器有许多静态的本地 PNG 图像,其中一些是重复的 。

我对应用程序进行剖析,我可以看到,当从“主”到“第二”控制器时,它分配了大约0.8 MB, 但是,当按后键时, 它并没有释放内存。 所以,当我再次去二级控制器时, 其它0.8 MB被分配了,等等...

调试时,我注意到, viewDiewDUnload: 的二级 unload: UIView主计长 方法从未被调用,但我还读到,这就是我应该将控制器保存的引用设为零的方法。 在 viewDisappled: 中这样做没有帮助,因为我希望只有在按下后按钮时才发生,也就是说,在从堆叠中弹出控制器( viewDisappear: 方法在将另一个控制器推到堆叠时也会被调用)。

问题是: 我是否必须这样做? 我可以强制将这种方法命名为吗? 行为是否确定( 任务, 在“ main” - & gt; “ second” - & gt; “ second” - & gt; “ main” - & gt; “ second” - & gt;... )?

提前感谢大家

问题回答

ARC is just used to reduce the code and manage the memory internally. For more details please go through the tutorial below so that you are able to understand the concepts more easily.

< a href=>""http://longlewellenendmobile.com/2011/09/07/objc- autern- reference-counting-in-xcode-explained/" rel="no follow" > 理解目标C 中的自动参考计数

我希望这能帮助你





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。