Re: Multiple Observations
Re: Multiple Observations
- Subject: Re: Multiple Observations
- From: Kyle Sluder <email@hidden>
- Date: Sat, 15 Jun 2013 09:32:09 -0700
On Jun 15, 2013, at 9:15 AM, Ken Thomases <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden