Re: NSTableView - populating from C procedure
Re: NSTableView - populating from C procedure
- Subject: Re: NSTableView - populating from C procedure
- From: Kyle Sluder <email@hidden>
- Date: Wed, 22 Jul 2009 23:00:00 -0700
On Jul 22, 2009, at 10:41 PM, Alexander Bokovikov
<email@hidden> wrote:
where it is said, among other, that NSTableView items may be filled
out like this:
Tables aren't actually filled with anything. Instead, you provide the
table with a data source object that fulfills the table's data needs
upon request.
getString(rowIndex, buf, &len);
return [NSString stringWithCString:buf length:len
encoding:NSUTF8StringEncoding];
Be aware that this method needs to be *fast*. This might mean caching
your values as they are generated, if possible.
I.e. is it possible to return a NSString without its preliminary
retaining?
Re-read the Cocoa memory management guide.
+stringWithCString:encoding: does not start with allocate or copy,
meaning you don't own it. Therefore you must not release it. Likewise,
the method you're implementing doesn't start with allocate or copy, so
you must not leak ownership of the returned object.
--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