Xcode 在应用程序加载时运行 IBAction
我想在应用程序加载之前隐藏一个窗口。现在我知道要隐藏一个窗口,你可以使用它;
[window2 orderOut:nil];
当您单击按钮时效果很好,但是如果我不想在应用程序加载之前或加载期间隐藏它怎么办?
所以在应用程序加载时需要一个 IBAction
I would like to hide a window before the app has loaded. Now I know to hide a window you can use this;
[window2 orderOut:nil];
which works fine when you click on a button but what if I wont it to be hidden before or whilst the application has loaded?
So sorta need an IBAction on when the application loads
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Interface Builder 中,您可以取消选中在启动时显示窗口的框(在窗口的属性窗格中)。
或者,您可以将该行代码放入应用程序委托的
applicationWillFinishLaunching
(或者可能applicationDidFinishLaunching
)方法中。 (我不确定,第一个可能不起作用。)但我个人会选择第一个选项。
In Interface Builder, you can uncheck the box (in the window's attributes pane) that says to show the window at startup.
Or you can put that line of code in your app delegate's
applicationWillFinishLaunching
(or perhapsapplicationDidFinishLaunching
) method. (Might not work in the first one, I'm not sure.)But I'd go with the first option, personally.