gpt4 book ai didi

cocoa - 如何从 xib 文件加载并显示窗口

转载 作者:行者123 更新时间:2023-12-03 17:19:28 25 4
gpt4 key购买 nike

我已经制作了一个窗口 xib 和 cocoa 类文件(nswindowcontroller),并且需要通过主窗口中的按钮操作来显示 xib 中的窗口。

最佳答案

在你的主 NSWindowController 中:

在界面中:

@property (nonatomic, strong) CustomWindowController *windowController;

实现中:

- (IBAction)didPressOpenWindowButton:(id)sender {
CustomWindowController *wc = [[CustomWindowController alloc] init];
[wc showWindow:nil];
[wc.window makeKeyAndOrderFront:nil];
_windowController = wc;
}

将 IBAction 连接到主窗口中的 NSButton。

关于cocoa - 如何从 xib 文件加载并显示窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38958404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com