【问题标题】:IBAction and IBOutlet in Custom NSWindowController自定义 NSWindowController 中的 IBAction 和 IBOutlet
【发布时间】:2014-02-04 10:42:15
【问题描述】:

我在我的 Cocoa 应用程序中设置了一个按钮来打开一个新窗口。我的自定义窗口控制器被声明为属性

@property (nonatomic, strong) MyWindowController *myWindowController;

当我的应用程序启动时,控制器被初始化

self.myWindowController = [[MyWindowController alloc] initWithWindowNibName:@"myWindow"];

当按钮被点击时,消息

[self.myWindowController showWindow:self];

被发送并且窗口出现。但是,当我向窗口添加视图时,我无法将它们连接到 myWindowController 中的 IBOutlets 和 IBActions。

总结:如何设置 myWindowController 来处理 myWindow 中的事件?

谢谢, 迈克尔·克努森

【问题讨论】:

    标签: objective-c cocoa nswindowcontroller


    【解决方案1】:

    解决了。对象 myWindowController 必须设置为 NIB 文件的所有者。在 Interface Builder 中单击它并在 Identity Inspector 中进行更改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-11
      • 1970-01-01
      • 1970-01-01
      • 2016-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多