我在 Cocoa 应用程序中设置了一个按钮来打开新窗口。我的自定义窗口 Controller 被声明为属性
@property (nonatomic, strong) MyWindowController *myWindowController;
当我的应用程序启动时, Controller 被初始化
self.myWindowController = [[MyWindowController alloc] initWithWindowNibName:@"myWindow"];
当点击按钮时,会出现消息
[self.myWindowController showWindow:self];
已发送并显示窗口。但是,当我向窗口添加 View 时,我无法将它们连接到 myWindowController 中的 IBOutlets 和 IBActions。
摘要:如何设置 myWindowController 来处理 myWindow 中的事件?
谢谢, 迈克尔·克努森
最佳答案
解决了。对象 myWindowController 必须设置为 NIB 文件的所有者。在 Interface Builder 中单击它并在 Identity Inspector 中进行更改。
关于objective-c - 自定义 NSWindowController 中的 IBAction 和 IBOutlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21550154/