Re: Custom cell with Bindings having strange prints in NSTableView
Re: Custom cell with Bindings having strange prints in NSTableView
- Subject: Re: Custom cell with Bindings having strange prints in NSTableView
- From: "Kyle Sluder" <email@hidden>
- Date: Thu, 28 Feb 2008 04:06:12 -0500
On Wed, Feb 27, 2008 at 8:55 AM, Miguel Coxo <email@hidden> wrote:
> Hello, i have a binding setup in IB like this:
>
> http://mt15.quickshareit.com/share/picture1f06b0.png
>
> where the cellData is a function in the class CPDownload:
>
> - (id) cellData
> {
> return self;
> }
This means [[foo cellData] description] is going to return the default
text of the form "<ClassName 0x12345678>". You want to bind the cell
to either a property or to the object itself and use a value
transformer. Overriding draw methods to display this data is usually
unnecessary, unless perhaps you are doing something out of the
ordinary in your drawing (since you're discussing downloads, perhaps
you are... maybe drawing a progress bar or somesuch).
> Then there is the CPDownloadQueue that has a NSArray with CPDownloads, and
> updates them like this:
>
> self.downloads = [downloads arrayByAddingObject: download];
Don't do this; you're wiping out the observed NSArray from underneath
the column's feet (bindings are accomplished through KVO). You want
to do this instead:
[[self mutableArrayValueForKey:@"downloads"] addObject:download]
--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