启动 Cocoa 应用程序而不显示主窗口
我有一个简单的 Cocoa 应用程序,带有一个 NSWindow,我可以在其中输入一些凭据,提交后应用程序会启动另一个进程。如果凭证输入一次并缓存,我想通过运行应用程序来启动该过程,而不显示应用程序的主窗口。我怎样才能做到这一点?
该应用程序只有一个符合 NSApplicationDelegate 的类和一个 .xib 文件。
I have a simple Cocoa app with a single NSWindow where I can enter some credentials and after the submission the app starts an another process. In case the credentials were entered once and cached I would like to start the process by running the app without showing the app's main window. How can I achieve that?
The app has only one class that conforms to NSApplicationDelegate and one .xib file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的窗口是从 xib 文件创建的吗?窗口的属性中应该有一个“启动时可见”复选框。
您将需要一些其他 UI(例如菜单项)来开始工作,或者您可以将其放入
applicationDidFinishLaunching:
中。Is your window created from a xib file? There should be a "Visible at launch" checkbox in the properties for the window.
You'll need some other UI (such as a menu item) to start your work going — or you could put that in
applicationDidFinishLaunching:
.在 MainMenu.xib 文件中,选择窗口并取消选中“启动时可见”。我相信这就是您需要做的全部。
In your MainMenu.xib file, select the window and uncheck "Visible at launch". I believe this is all you need to do.