• 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: troubles with tableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: troubles with tableview


  • Subject: Re: troubles with tableview
  • From: Graham Cox <email@hidden>
  • Date: Mon, 30 Nov 2009 20:57:52 +1100

On 30/11/2009, at 7:21 PM, Dorimedont Bancescu wrote:

> -why in initWithCoder the array is loaded, has all the elements and when numberOfRowsInTableView message is send the array is empty and has a different memory address?


Probably because you have two distinct objects. Check the address of 'self' in the case of -init and -initWithCoder:

-initWithCoder: is, as its name suggests, an init method, which is invoked on a freshly alloc'ed object. It is not invoked on an existing object to provide it with new content. I think your problem probably lies in the code above this that is causing the -initWithCoder: method to be invoked by dearchiving something. When you do that you get a new object, but the table's datasource is still set to the previous one.

I'm cc'ing this back to the list in case anyone else can put their finger on it, but from what you've posted so far that's my best guess.

--Graham


_______________________________________________

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: 
 >troubles with tableview (From: Dorimedont Bancescu <email@hidden>)
 >Re: troubles with tableview (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: My try/catch block isn't catching exceptions on 10.6
  • Next by Date: NSWorkspace in a daemon
  • Previous by thread: Re: troubles with tableview
  • Next by thread: How to draw text to bitmap (array) with pre 10.5 libs
  • Index(es):
    • Date
    • Thread