self registering NSValueTransformer and bindings
self registering NSValueTransformer and bindings
- Subject: self registering NSValueTransformer and bindings
- From: Torsten Curdt <email@hidden>
- Date: Wed, 7 May 2008 17:13:20 +0200
I have a self registering NSValueTransformer that requires a binding.
@interface MyValueTransformer : NSValueTransformer {
IBOutlet NSTabView *tabView;
}
+ (Class)transformedValueClass;
+ (BOOL)allowsReverseTransformation;
- (id)transformedValue:(id)value;
@implementation MyValueTransformer
// from http://www.gigliwood.com/weblog/
+ (void)load
{
NSLog(@"registered %@", NSStringFromClass([self class]));
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSValueTransformer *theTransformer = [[[self alloc] init]
autorelease];
[NSValueTransformer setValueTransformer:theTransformer
forName:NSStringFromClass([self class])];
[pool release];
}
+ (Class)transformedValueClass
{
return [NSNumber class];
}
+ (BOOL)allowsReverseTransformation
{
return NO;
}
- (id)transformedValue:(id)value
{
NSLog(@"transforming value %@ for view %@", value, tabView);
return [NSNumber numberWithInt:0];
}
@end
I've instantiate it through the NIB. Which works fine! I do see the
NSLog lines and all.
Unfortunately the IBOutlet stays nil ...but in the bindings inspector
I can see the proper binding on the transformer.
Any idea?
cheers
--
Torsten
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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