views:

190

answers:

1

Hi,

I've googled around and found some answers but I didn't get any of them to work. I have one NSObject with the class "A" and a second class "B" without an NSObject. In class "A" are my IBOutlets defined and I can't seem to figure out how to access those outlets from class "B"...

I've found answered questions like http://forums.macrumors.com/archive/index.php/t-662717.html But they're confusing.

Any help would be greatly appreciated!

Simplified Version of the Code:

aClass.h:

#import <Cocoa/Cocoa.h>

@interface aClass : NSObject {
    IBOutlet NSTextField *textField;
}
@end


aClass.m:

#import "aClass.h"

@implementation aClass
// Code doesn't matter
@end


bClass.h:

#import <Cocoa/Cocoa.h>

@interface bClass : NSObject {
}
@end


bClass.m:

#import "aClass.h"
#import "bClass.h"

@implementation bClass
    [textField setStringValue: @"foo"];
@end
+1  A: 

When you write:

I have one NSObject with the class "A" and a second class "B" without an NSObject.

It tells me that you don't have your head around the basic concepts. Read through Apple's objective-C introduction, and the tutorial projects.

NSResponder
I am reading http://www.amazon.com/Programming-Objective-C-2-0-Stephen-Kochan/dp/0321566157I guess it will come down to the same eventually.