• 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: Using NSValueTransformer to update transformed value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSValueTransformer to update transformed value


  • Subject: Re: Using NSValueTransformer to update transformed value
  • From: Keary Suska <email@hidden>
  • Date: Thu, 07 Jan 2016 07:57:20 -0700

> On Jan 7, 2016, at 4:04 AM, Etan Kissling <email@hidden> wrote:
>
> I have a NSTextField whose value is bound to a String.
> I've also created a NSValueTransformer that converts this string to uppercase when stored into the model.
>
> When I type in a new value, the stored model is indeed uppercased.
> When I load back the value, the displayed value is also uppercased.
>
> However, when I type in the new value, hit enter, the user-entered value is still displayed - I would like to update that to also display the uppercased value.
> Is this something that can be solved directly with NSValueTransformer,
> or do I have to use the NSTextFields delegate methods to manually reload the value once editing has ended?

You probably don’t want an NSValueTransformer, but an NSFormatter. NSValueTransformer just acts as a translator between how the model wants to store data and how the view wants to store it. Formatters, on the other hand, are used to normalize and validate entered data entered in a view.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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


  • Prev by Date: Re: Best Place to Store Config Files on Mac
  • Next by Date: Re: My alert is not firing at all
  • Previous by thread: Re: Best Place to Store Config Files on Mac
  • Next by thread: Re: My alert is not firing at all
  • Index(es):
    • Date
    • Thread