Re: Why would a defined selector not be found at runtime?
Re: Why would a defined selector not be found at runtime?
- Subject: Re: Why would a defined selector not be found at runtime?
- From: Ken Tozier <email@hidden>
- Date: Thu, 12 May 2005 13:28:55 -0400
On May 12, 2005, at 11:37 AM, Ricky Sharp wrote:
On May 12, 2005, at 4:46 AM, Ken Tozier wrote:
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?
Hmm, I think this has something to do with splitting up the alloc
and init calls. I seem to recall some thread about this a while back.
At any rate, what happens if you do this instead:
NSDisclosureButtonCell* result = [[NSDisclosureButtonCell alloc]
initWithControlSize:inControlSize];
That's normally how I alloc/init things. When I found it didn't work
the normal way, I broke it up into two separate steps with NSLog's
before each telling me exactly where it was breaking, like this.
NSLog(@"about to allocate result");
NSDisclosureButtonCell *result = [NSDisclosureButtonCell alloc];
NSLog(@"about to init result");
[result initWithControlSize: inControlSize];
Either way you get the same error message at runtime.
Other notes...
It appears that NSDisclosureButtonCell is your own class, thus you
shouldn't name it with the 'NS' prefix.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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