如何判断 Cocoa MainMenu 控件何时已加载
如何判断所有 MainMenu 笔尖控件(主要是主窗口)何时已加载?我想在启动时在主窗口顶部显示一个工作表,但是当我将调用 beginSheet 放在 awakeFromNib 内部时,我收到错误,因为尚未显示任何窗口: : kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
如何修复此问题?
How can I tell when all of the MainMenu nib controls (primarily the main window) have been loaded? I want to display a sheet on top of the main window at launch, but when I put call beginSheet inside of awakeFromNib, I get an error because no windows have been displayed yet: : kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
How can this be fixed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这种类型的操作,我建议使用 -applicationDidFinishLaunching 委托方法。您将在应用程序委托中实现此功能。从那里开始工作表,然后您就可以保证 MainMenu.nib/xib 已加载。
For this type of action, I'd suggest using the -applicationDidFinishLaunching delegate method. You'll implement this in your application delegate. Start the sheet from there and you're guaranteed that MainMenu.nib/xib is loaded by then.