I create MyImageView (from NSImageView) which must use MyImageCell (from NSImageCell). I put MyImageView in MyWindow with Interface Builder, creating an NSImageView and setting its class to MyImageView.

In MyImageView.m I put:

@implementation MyImageCell

- (void)encodeWithCoder:(NSCoder *)aCoder {
   [super encodeWithCoder:aCoder];
}

- (id)initWithCoder:(NSCoder *)decoder
{
   if (self = [super initWithCoder:decoder])
   {
       ...
   }
   return self;
}
...
@end

@implementation MyImageView

+ (void)initialize {
   if (self == [MyImageView class]) {
       [self setCellClass:[MyImageCell class]];
   }
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
   [super encodeWithCoder:aCoder];
}

- (id)initWithCoder:(NSCoder *)decoder
{
   if (self = [super initWithCoder:decoder])
   {
       [self setEnabled:YES];
       [[self cell] setSelectable:YES];
       [self setImageFrameStyle:NSImageFrameGrayBezel];
       ...
   }
   return self;
}
...
@end

Well: MyImageView is properly created, by its cell is still an NSImageCell, and not MyImageCell.

Can you tell me why?

Besides if I call a public MyImageView's method with [NSApp sendAction:@selector(anAction:) to nil] nothing happens ([NSApp targetForAction:@selector(anAction:)] returns nil).

Why?

Thank you very much in advance,
best regards,
livio.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to