如何在iPhone SDK中处理插座的内存管理 [英] How do you handle memory management of outlets in the iPhone SDK

查看:187
本文介绍了如何在iPhone SDK中处理插座的内存管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于KVC用于在iPhone上设置插座,因此有两种方法(我知道)可以确保您正确处理内存管理。

Since KVC is used to set outlets on the iPhone, there are 2 methods (that I know of) to make sure you've properly handled memory management.

具体来说,我指的是Aaron Hillegass撰写的文章

Specifically, I am referring to this article written by Aaron Hillegass.

我的问题是你使用哪种方法以及你的推理是什么?

My question is which method do you use and what is your reasoning?


  • 释放你所有的网点dealloc
    和viewDidUnload(确保你在viewDidUnload中将
    设置为nil。)

  • 使你的网点弱引用

就个人而言,我倾向于使用弱引用,因为它看起来更清晰。

Personally, I am leaning towards using weak references as it seems cleaner.

推荐答案

我选择弱参考。正如你所说,它不那么混乱,并使一个已经过于冗长的代码foorprint更易于管理

I go with weak references. As you say its less cluttered and makes an already overly verbose code foorprint a little more manageable

这篇关于如何在iPhone SDK中处理插座的内存管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆