我有一个带有 IBOutlet 的控制器,如下所示:
@interface MyController : NSViewController <NSPopoverDelegate>
{
IBOutlet NSWindow *detachedWindow;
}
@property (retain, nonatomic) NSWindow *detachedWindow;
@end
我想detachedWindow
在一个类中访问那个 outlet(): 这个子类是为基于视图的表视图中的单元格视图添加的。
@interface HoverTableRowView : NSTableRowView<NSTableViewDelegate,NSPopoverDelegate> {
__weak MyController *_delegateObject;
}
@implementation HoverTableRowView
@synthesize delegateObject = _delegateObject;
- (void)awakeFromNib
{
NSLog(@"awake from nib is being called");
NSLog(@"detached window outlet is--%@",[[self delegateObject ]detachedWindow]);
}
@end
但detached window outlet is--
总是回归null
。如何在“HoverTableRowView”类中访问该插座?