• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
self registering NSValueTransformer and bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: self registering NSValueTransformer and bindings
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Deep sleep and file wrappers?
  • Next by Date: Re: Sending an image to Preview to preview the image
  • Previous by thread: [moderator] Re: offtopic: cocoa iphone
  • Next by thread: Re: self registering NSValueTransformer and bindings
  • Index(es):
    • Date
    • Thread