I might as well ask this now. I am running a test to have my program use many classes to work together. But something is going wrong right away. I have an appDelegate class that was created with an NSWindow in it. I added a simple NSButton in the first window. I created a second NSWindow within the appDelegate as well. I then created my AppController class and assigned my 1 button to it. In the appController class I added the #import for my appDelegate class so I can access it's methods.
Then in the IBAction Method for the 1 button I asked it to open up the second NSWindow. I get an error "Use of undeclared identifier
appDelegate.h
appDelegate.m
AppController.h
AppController.m
main.m
What am I doing wrong?
Then in the IBAction Method for the 1 button I asked it to open up the second NSWindow. I get an error "Use of undeclared identifier
appDelegate.h
Code:
#import <Cocoa/Cocoa.h>
@interface testTwoClassesAppDelegate : NSObject <NSApplicationDelegate> {
@private
NSWindow *window;
NSWindow *infoEntryWindow;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *infoEntryWindow;
@end
Code:
#import "testTwoClassesAppDelegate.h"
@implementation testTwoClassesAppDelegate
@synthesize window;
@synthesize infoEntryWindow;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
@end
Code:
#import <Foundation/Foundation.h>
#import "testTwoClassesAppDelegate.h"
@interface AppController : NSObject {
@private
}
- (IBAction)NewEnteryButton:(id)sender;
@end
Code:
#import "AppController.h"
#import "testTwoClassesAppDelegate.h"
@implementation AppController
- (IBAction)NewEnteryButton:(id)sender {
[infoEntryWindow makeKeyAndOrderFront:self];
}
@end
Code:
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}
What am I doing wrong?
Last edited: