what about registering a transformer in the transformer?
what about registering a transformer in the transformer?
- Subject: what about registering a transformer in the transformer?
- From: Marc Respass <email@hidden>
- Date: Wed, 6 Dec 2006 14:17:44 -0500
Hi All,
I have a bunch of transformers. In order to use them, I have to
initialize them, autorelease, then register. I am guessing (since
autorelease works) that setValueTransformer retains my transformer. I
am also guessing that the bindings system is asking the
NSValueTransformer valueTransformerForName: and passing the name I
use in IB (which makes me wonder if I can register using a different
name - I always use the class name - but that's beside the point).
So I always have to paste this code into +initialize of the class
that uses the transformer and I'm looking for a better way
id transformer = [[[PersonNameOnlyTransformer alloc] init]
autorelease];
[NSValueTransformer setValueTransformer:transformer
forName:@"PersonNameOnlyTransformer"];
I though that there's no reason I can't register a transformer in
+initialize of the transformer but then it probably won't be
registered when it's needed (which would be the reason I was looking
for). Anyone have any good ideas? A simple object that just registers
all my transformers? It still has to be called but it's one line vs
two for each transformer pasted in. [TransformerRegistrar register]
is easy to remember too. What do you guys do?
Marc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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