On Jun 15, 2013, at 9:15 AM, Ken Thomases <k...@codeweavers.com> wrote:

> 
> The view controller is presumably the NIB's File's Owner.  Therefore, per 
> what Kyle said, it has -awakeFromNib called on it every time the NIB is 
> loaded.  The NIB is being loaded to instantiate each cell view, so 
> -awakeFromNib is called each time.

It's slightly more subtle than that: the NIB will only be loaded if there is no 
view in the reuse queue for that identifier. So people might get bit by the 
_opposite_ of Gordon's issue, whereby they expect -awakeFromNib to _always_ be 
called on the table view's delegate.

Moral of the story: do all your important cell view initialization in 
-tableView:viewForTableColumn:row:, and protect your table view's delegate from 
multiple -awakeFromNib calls by setting a flag and early-returning.

And be conscious and grateful that the iOS team made -awakeFromNib behave more 
sanely in UIKit.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to