Re: Using NSValueTransformer with a double
Re: Using NSValueTransformer with a double
- Subject: Re: Using NSValueTransformer with a double
- From: Paul Bruneau <email@hidden>
- Date: Wed, 10 Oct 2007 12:05:38 -0400
On Oct 10, 2007, at 11:32 AM, Stephen F. Booth wrote:
I have an object with an instance variable of type NSTimeInterval
which as you know is actually just a double containing number of
seconds.
I would like to bind this ivar to an NSTextField on my interface
which works fine, except that it displays in seconds of course. I
want the user to experience this value in minutes.
So I look at NSValueTransformer which seems to be made exactly for
this type of thing.
I would recommend using NSFormatter in lieu of NSValueTransformer
for this case, since you are just reformatting data for
presentation to the user. It doesn't seem to me that you actually
need to transform the value. In my experience the lines between
NSValueTransformer and NSFormatter can become blurred.
OK in looking at NSFormatter I don't think it will work for me
because although I might have been too subtle in my description, I am
using Bindings, which NSValueTransformer seems better able to work
with, and I do want not only to present the transformed value to the
user, but I need the reversability that NSValueTransformer offers
because I want the user to be able to adjust the value and have it
get transformed back into seconds for storage back into my object.
If I'm not correct, please don't hesitate to redirect me :)
_______________________________________________
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