我正在为一个窗口设置父属性,当我签入该属性时windowDidLoad
,一切都很好。但是当我检查它时IBAction
,它是零。我在这里想念什么?
应用控制器.m
loginController = [[LoginController alloc] initWithWindowNibName:@"Login" owner:self];
loginController.parent = self;
[[loginController window] makeKeyAndOrderFront:self];
登录控制器.h
@property (nonatomic, weak) AppController *parent;
LoginController.m @synthesize 父级;
- (void)windowDidLoad
{
[super windowDidLoad];
NSLog(@"Parent: %@", self.parent); //<--- Parent: <AppController: 0xblahblah>
}
- (IBAction)login:(id)sender
{
NSLog(@"Parent: %@", self.parent); //<--- nil
}