0

Possible Duplicate:
Do I need to release xib resources?

IBOutlet WeaponStoreViewTableCell *tblCell;

I have this instance variable in my code. It is tied to a NIB using interface builder. Do I need to throw a release for this in my dealloc method?

Community
  • 1
  • 1
Mel
  • 2,055
  • 2
  • 26
  • 45

2 Answers2

0

The general rule is if you retain it (or it's retained on your behalf), you release it. If you declare a property (with retain specified) for the cell, then it gets retained on your behalf, and you need to (somehow) release it. If you don't then not.

Hot Licks
  • 47,103
  • 17
  • 93
  • 151
0

The way this is handled in iOS apps and Mac OS Apps seems to be difference, the underlining rule for retain/release are the same but iOS apps tend to use properties with (retains) properties to connect them to the item in you nib files so in this case you have to release to balance the retain from you property. In mac OS X the practice seems to be connect the interface elements straight to you ivars, which is a straight assign, in the situation you don, t have to blance with a release because the interact elements is retains by you NSNib object with is retains by you NSWindowController class so all of that is angled for you. My personnel feeling is that I attach interface elements straight to the ivar, so I don't have to release them myself I will then have a property which is readonly since I vary rarely want to change an interface ivar once it has been set by the nib but this really is all just a matter of personnel style.

Nathan Day
  • 5,981
  • 2
  • 24
  • 40