gpt4 book ai didi

cocoa 片出现在随机位置

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

我正在尝试创建一个从自定义 nib 文件加载的工作表,并拥有自己的窗口 Controller 。在我的应用程序委托(delegate)中,按下按钮后,我调用

- (IBAction)loginLogout:(id)sender {
if (![self isLoggedIn]) {
// need to login
LoginManager *manager = [[LoginManager alloc] initWithWindowNibName:@"LoginSheet"];
[manager presentLoginWithWindow:self.window];
}
}

然后在窗口 Controller (LoginManager 类)中,我有这个

- (void)presentLoginWithWindow:(NSWindow *)window {
if (!self.window) {
[NSBundle loadNibNamed:@"LoginSheet" owner:self];
}

[NSApp beginSheet:self.window modalForWindow:window modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:nil];
}

但我最终得到了这个。

enter image description here

最佳答案

也许您在 Interface Builder 中选中了工作表窗口的“启动时可见”选项?

关于 cocoa 片出现在随机位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9981957/

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