On Oct 28, 2008, at 12:19 AM, Jean-Nicolas Jolivet wrote:

Now, assuming I want to bind an array of those File objects to a Table View, however, what I would like to display in the table's column is not the complete path of the file, but just the file name (that I get with [filePath lastPathComponent])....

What would be the best way to achieve that? Basically: I want to bind my column to a property that doesn't really exist (i.e. only part of the filePath property)...


You can use a custom value transformer. You would implement +transformedValueClass to return an [NSString class] and - transformedValue: to return the lastPathComponent of the passed in string. Set the transformer for the binding and you should be set.

There are a few samples that you can reach from the Xcode docs demonstrating this (just look up NSValueTransformer).
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to