“锁定" Mac App上的屏幕 [英] "Lock" Screen On Mac App

查看:138
本文介绍了“锁定" Mac App上的屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac OS X中,我需要调用什么API才能在整个屏幕上以及菜单栏和停靠窗口上放置一个窗口?另外,是否可以有效地将屏幕锁定"到此位置,从而禁用任务控制,启动板等?

In Mac OS X, what API do I need to call in order to place a window over not only the entire screen, but the menu bar and dock as well? Also, is it possible to effectively "lock" the screen into this position, disabling Mission Control, launchpad, etc.?

我在App Delegate的实现文件中尝试了以下代码:

I have tried the following code within the App Delegate's implementation file:

- (void)awakeFromNib {
    @try {
        NSApplicationPresentationOptions options = NSApplicationPresentationDisableForceQuit + NSApplicationPresentationDisableHideApplication + NSApplicationPresentationDisableProcessSwitching + NSApplicationPresentationHideDock + NSApplicationPresentationHideMenuBar + NSApplicationPresentationFullScreen;
        [NSApp setPresentationOptions:options];
        NSLog(@"Set presentation options"); 

    }
    @catch (NSException *exception) {
        NSLog(@"Error. Invalid options");
    }

}

NSLog读取设置演示文稿选项",但没有其他反应.有提示吗?

NSLog reads "Set presentation options", but nothing else happens. Any tips?

推荐答案

这基本上涉及与信息亭模式"相同的事物.请参阅 Apple的Kiosk模式编程主题.

This would basically involve the same sorts of thing as "kiosk mode". See Apple's Kiosk Mode Programming Topic.

您基本上将-[NSApplication setPresentationOptions:]-[NSView enterFullScreenMode:withOptions:]与包含键NSFullScreenModeApplicationPresentationOptions的选项字典一起使用,该键的值是NSNumber,其包含与方法所用的相同类型的表示选项值.

You basically use -[NSApplication setPresentationOptions:] or -[NSView enterFullScreenMode:withOptions:] with an option dictionary containing the key NSFullScreenModeApplicationPresentationOptions whose value is an NSNumber containing the same sort of presentation option values as the NSApplication method takes.

这篇关于“锁定" Mac App上的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆