• 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 not setting model property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding not setting model property


  • Subject: Re: Binding not setting model property
  • From: Dave Fernandes <email@hidden>
  • Date: Sat, 18 Jan 2014 22:21:11 -0500

How are you setting up the binding? Normally you bind to the value property of the NSTextField (not stringValue). See Cocoa Bindings Reference (NSTextField Bindings).

On Jan 18, 2014, at 9:41 PM, Roland King <email@hidden> wrote:

> I have a model object with a codeURL property which is readwrite and is an NSURL.
>
> I have an NSTextField in the NSView subclass with the value bound to the codeURL property with a custom transform which turns a URL into a string (and deals with nil and another edge case).
>
> The transform is reversible, returns YES for allowsReverseTransform and has an implemented reverseTransformedValue: method.
>
> There's a browse button on the UI which lets the user select a file and then sets the stringValue: property of the NSTextField to the url.path of the file selected.
>
> What I expected is that setting the stringValue would invoke the transformer in the reverse direction and set the codeURL property to the reverse transformed value, thus binding the codeURL property in both directions.
>
> What actually happens is nothing. The transformer reverse method isn't called and the codeURL isn't changed. It works in the forward but not the reverse direction. I have a checkbox similarly bound (with no transform) and that works fine both ways.
>
> This is my first foray into bindings .. what could I be doing wrong? Do I need to express a simple NSString property on the model object and bind that instead and do the NSString/NSURL conversion there?
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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


  • Follow-Ups:
    • Re: Binding not setting model property
      • From: Roland King <email@hidden>
References: 
 >Binding not setting model property (From: Roland King <email@hidden>)

  • Prev by Date: Re: Binding not setting model property
  • Next by Date: Re: System fonts on iOS 7
  • Previous by thread: Re: Binding not setting model property
  • Next by thread: Re: Binding not setting model property
  • Index(es):
    • Date
    • Thread