Re: Binding question
Re: Binding question
- Subject: Re: Binding question
- From: David Duncan <email@hidden>
- Date: Tue, 28 Oct 2008 11:31:38 -0700
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 (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