arnoapp
arnoapp

Reputation: 2506

Cocoa Bindings: Check when value is changed

I'm displaying a value containing of 3 seperate pieces in a view where the values can be changed.

I'm using NSValueTransformer to put the pieces( actually 3 core data entities fetched by an binded arraycontroller) together.

But know I need to make sure that the user doesn't change the value to a specific range and I need to get the 3 values back for the core data objects.

How can I achieve this? Is there an routine in NSValueTransformer or do I need to subclass the array controller?

Upvotes: 0

Views: 81

Answers (1)

stevesliva
stevesliva

Reputation: 5665

If you have set up the NSValueTransformer subclass to return YES for allowsReverseTransformation, and if you can write the code to implement reverseTransformedValue, the you can also have your core data entities do validation for the attributes that you are binding. Alerts will popup to alert the user when they've done something invalid.

Without more information on what exactly we're talking about... strings or numbers or whatever, that's about as specific as I can get. In other words, if you can't write code for reverseTransformedValue, then you can't expect anything to separate the user input into 3 components to validate.

Upvotes: 1

Related Questions