Why would a defined selector not be found at runtime?
Why would a defined selector not be found at runtime?
- Subject: Why would a defined selector not be found at runtime?
- From: Ken Tozier <email@hidden>
- Date: Thu, 12 May 2005 05:46:41 -0400
This is most likely a stupid error on my part, but I'm getting a
"selector not recognized" error for a method that is definitely
defined in my NSButtonCell subclass.
The interface is defined like this:
#import <Cocoa/Cocoa.h>
@interface NSDisclosureButtonCell : NSButtonCell
{
NSBezierPath *collapsedBezel;
NSBezierPath *expandedBezel;
}
- (id) initWithControlSize:(NSControlSize) inSize;
@end
The implementation of the problematic method is defined like this:
#import "NSDisclosureButtonCell.h"
- (id) initWithControlSize:(NSControlSize) inSize
{
self = [super init];
if (self == nil)
return nil;
[self setControlSize: inSize];
[self initCollapsedBezel];
[self initExpandedBezel];
return self;
}
A factory method in a separate "UIControls" class is defined like this:
@class NSDisclosureButtonCell;
@interface UIControls: NSObject
+ (NSDisclosureButtonCell *) plainDisclosureBezelInView:(NSView *)
inView
origin:(NSPoint) inOrigin
size:(NSControlSize) inControlSize;
@end
And it's being called from the factory method like this:
#import "NSDisclosureButtonCell.h"
@implementation UIControls
+ (NSDisclosureButtonCell *) plainDisclosureBezelInView:(NSView *)
inView
origin:(NSPoint) inOrigin
size:(NSControlSize) inControlSize
{
NSDisclosureButtonCell *result =
[NSDisclosureButtonCell alloc];
// always chokes on the next line at runtime
[result initWithControlSize: inControlSize];
[result setState: NSOffState];
return [result autorelease];
}
@end
As is clear from above, everything seems to be defined correctly and
the necessary "#import" directives are present, so why am I getting
"*** -[NSDisclosureButtonCell initWithControlSize:]: selector not
recognized" at runtime?
I put NSLogs in the "plainDisclosureBezelInView" method and they show
that the allocation executes OK, the "inControlSize" contains a valid
value but when it gets to the "initWithControlSize" method I always
get the "selector not recognized" error. Anyone see the problem?
Thanks
Ken
_______________________________________________
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