Re: registering and use of bindings value transformers
Re: registering and use of bindings value transformers
- Subject: Re: registering and use of bindings value transformers
- From: Shaun Wexler <email@hidden>
- Date: Sat, 11 Mar 2006 08:44:59 -0800
On Mar 11, 2006, at 2:36 AM, Mike Abdullah wrote:
Can anybody help me get my head around how the registration process
for custom value transformers is supposed to work? I've read the
docs etc. but I'm still not entirely clear.
First, how many instances of my transformer should there be in the
app. Say I have multiple document windows and each one has one
interface element that uses the transformer, should I have an
instance for each of the interface elements, or is there a single
instance that all the elements share?
Of course, my real question, is when do I carry out this
"registration"? The docs just say in the app's delegate, but I
don't really get which delegate method I should be doing this in.
I guess things also depend my above question.
NSString const *defaultTransformerName =
@"MYSuperDuperToFancySchmancyphizer";
static MYValueTransformer *defaultTransformer;
+ (void)load
{
[self class]; // force +initialize
}
+ (void)initialize
{
defaultTransformer = [[self allocWithZone:[self zone]] init];
[self setValueTransformer:defaultTransformer
forName:defaultTransformerName];
}
+ (MYValueTransformer *)defaultTransformer
{
return defaultTransformer;
}
--
Shaun Wexler
MacFOH
http://www.macfoh.com
"Things should be described as simply as possible, but no simpler." -
Albert Einstein
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden