Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
610 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...