在 Mac 中以编程方式禁用菜单栏和停靠栏
我是 Mac 编程新手,我必须执行一项任务。我需要创建一个应用程序,该应用程序将在启动时运行并覆盖整个屏幕,并且在插入自定义密码之前不会关闭。 菜单栏和停靠栏需要隐藏在该应用程序后面,并且在给出信息之前无法关闭该应用程序。
到目前为止,我已经编写了在启动时运行的代码。但我似乎无法禁用菜单栏和停靠栏并锁定所有用户操作,除非他提供我想要的密码。
该怎么办 !!!!
i am new to mac programming and i have to perform a task. I need to make an application that will run at startup and cover the complete screen and will not close until my custom passcode is inserted.
The menu bar and dock needs to be hidden behind this application and the application cannot be closed until the information is given.
So far i have written the code that would run at startup . But i cant seem to disable the menu bar and dock and lock all user actions unless he gives the passcode i want.
What to do !!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想在 Swift(Xcode、Mac OS X 应用程序)中隐藏菜单栏,您可以:
如果您想再次显示菜单栏:
请记住,“setMenuBarVisible”是一个类函数,并不存在于类的实例中。因此以下行是不可能的:
并且会导致错误,指出 func“setMenuBarVisible”未定义。
If you want to hide the Menu-Bar in Swift (Xcode, Mac OS X Application), you do:
If you want to show the Menu-Bar again:
Please keep in mind, that "setMenuBarVisible" is a class function and does not exist for instances of a class. So the following line is not possible:
And will result in an error, saying, that the func "setMenuBarVisible" is not defined.