• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple Observations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Multiple Observations (From: Gordon Apple <email@hidden>)
 >Re: Multiple Observations (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Multiple Observations
  • Next by Date: Re: Multiple Observations
  • Previous by thread: Re: Multiple Observations
  • Next by thread: Re: Multiple Observations
  • Index(es):
    • Date
    • Thread