• 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: Binding question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding question


  • Subject: Re: Binding question
  • From: Jean-Nicolas Jolivet <email@hidden>
  • Date: Tue, 28 Oct 2008 15:32:09 -0400

Mmmm seems like value transformer would be another way to do it! I will definitely look into both methods! Since my property is in fact only used for display purposes, I guess it would make sense to use a transformer to display it...

Jean-Nicolas Jolivet

David Duncan wrote:
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


References: 
 >Binding question (From: Jean-Nicolas Jolivet <email@hidden>)
 >Re: Binding question (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Binding question
  • Next by Date: Re: Code signing validation
  • Previous by thread: Re: Binding question
  • Next by thread: Re: Binding question
  • Index(es):
    • Date
    • Thread