Friday, April 13, 2012

Nib Memory Management

Mike Ash:

Nib memory management is similar between Mac and iOS but just different enough to be annoyingly confusing. Fortunately, it’s easy to mitigate the confusion by sticking to areas where the two platforms behave identically, which results in best practices anyway. Always use a Cocoa controller to load nibs rather than loading the nib directly yourself. Always declare properties for your outlets. As with any property, if your outlet properties are strong, then you must release the backing instance variable in dealloc (or let ARC do it for you).

I kind of wonder why they didn’t fix the top-level objects issue when introducing NSNib. It’s not even mentioned in the documentation.

Comments RSS · Twitter

Leave a Comment