Hi,

Can someone explain to me why I get this compiler warning (BigLetterView is a subclass of NSView):

'BigLetterView' may not respond to '-prepareAttributes'



- (id)initWithFrame:(NSRect)rect {
        
        if(![super initWithFrame:rect]) {
                return nil;
        }       
        NSLog(@"intializing view");
        [self prepareAttributes]; // <------------ warning on this line
        bgColor = [[NSColor yellowColor] retain];
        string = @" ";

    return self;
}

while later in the same source file, the following method is defined:

- (void)prepareAttributes
{
        NSLog(@"prepareAttributes called");
        attributes = [[NSMutableDictionary alloc] init];
[attributes setObject:[NSFont fontWithName:@"Helvetica" size:75] forKey:NSFontAttributeName]; [attributes setObject:[NSColor redColor] forKey:NSForegroundColorAttributeName];
}

I know I can fix this easily by declaring prepareAttributes in the header file or in an @interface block in the '.m' file, but I'm curious why I get this warning if an only if I make the call in the initWithFrame method. Calling [self prepareAttributes] in any other method doesn't generate any warning.

Does calling an instance method in the initialization phase require something special?

Thanks,

Andre Masse

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to