• 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: NSControl Multiple Values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSControl Multiple Values


  • Subject: Re: NSControl Multiple Values
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 02 Nov 2015 13:35:42 -0800
  • Feedback-id: 167118m:167118agrif8a:167118s0ahZOxSq0:SMTPCORP
  • X_v_e_cd: 3f18444569226b0eddf5b6f03ef5c0dd
  • X_v_r_cd: 40ae839347c0cec1f842b1597582d5f6

On Nov 2, 2015, at 12:51 , Richard Charles <email@hidden> wrote:
>
> So that is interesting that NSControl will work with a double. My custom binding works with double values. But after doing a little searching on the web it appears that value transformers do not work with double values unless you change the double into a NSNumber.

That’s not quite how it is. NSControl doesn’t work with a double either — its underlying value is always an object (‘objectValue’), and ‘doubleValue’ converts the object back to a scalar value.

What actually happens is that KVC, which is what bindings use to fetch values for e.g. controls, has built in behavior to convert certain scalar properties to objects. So you should write the value transformer to take and produce a NSNumber object, and KVC should handle all the necessary conversions for you.

_______________________________________________

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: 
 >NSControl Multiple Values (From: Richard Charles <email@hidden>)
 >Re: NSControl Multiple Values (From: Quincey Morris <email@hidden>)
 >Re: NSControl Multiple Values (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: Crash running C code built on OS X El Capitan in Xcode 7
  • Next by Date: UISearchBar over UINavigationBar with custom background color
  • Previous by thread: Re: NSControl Multiple Values
  • Next by thread: Re: Crash running C code built on OS X El Capitan in Xcode 7
  • Index(es):
    • Date
    • Thread