Re: IBOutlet id
Re: IBOutlet id
- Subject: Re: IBOutlet id
- From: "Louis C. Sacha" <email@hidden>
- Date: Sat, 21 Feb 2004 00:22:42 -0800
Hello...
You get the error because you haven't told the compiler/preprocessor
what an NSWindowSubclass is...
In your header file, you can just use the @class directive to declare
that certain things are classes:
@class NSWindowSubclass, YourOtherCustomClass;
In the implementation file, you need to include the header file for
those classes:
#import "NSWindowSubclass.h"
#import "YourOtherCustomClass.h"
So, for example, if you had a controller class YourAppController
- - YourAppController.h - - -
#import <Cocoa/Cocoa.h>
@class NSWindowSubclass, YourOtherCustomClass;
@interface YourAppController : NSObject
{
IBOutlet NSWindowSubclass *customWindow;
IBOutlet YourOtherCustomClass *customOtherThing;
/* ... other instance variables */
}
/* ... methods ... */
@end
- - - - - - - - - - -
- - YourAppController.m - - -
#import "YourAppController.h"
#import "NSWindowSubclass.h"
#import "YourOtherCustomClass.h"
@implementation YourAppController
/* ... methods ... */
@end
- - - - - - - - - - -
Hope that helps...
Louis
I have a couple of custom classes for which I am creating instances
in Interface Builder. I declare these classes as follows, and then
link them up in IB:
IBOutlet id anNSWindowSubclass;
The problem is that all of the messages I send to anNSWindowSubclass
yield compiler warnings (which aren't a problem, they are just
annoying):
warning: cannot find method `-updateLocations'; return type `id' assumed
This is understandable, since it doesn't know the class of the
object to which these messages are being sent.
What I would like to do is the following declaration:
IBOutlet NSWindowSubclass *anNSWindowSubclass;
But when I declare the instance that way, I get this error:
error: parse error before "NSWindowSubclass"
Why do I get this error? What have others done differently to avoid
this problem?
Thanks,
-- Daniel Currie
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >IBOutlet id (From: Daniel Todd Currie <email@hidden>) |