检测或对Guided Access做出反应? [英] Detect or react to Guided Access?

查看:248
本文介绍了检测或对Guided Access做出反应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们正在创建的应用中,我们需要添加一些额外的屏幕来配置应用。

In an app we're creating, we need to add some extra screens to configure the app.

如果我们可以添加额外的按钮,这将是很好的打开应用程序的屏幕,仅当iPad未处于引导访问状态时才可见。

It would be nice if we could add extra buttons on the opening screen of the app, that is only visible if the iPad is not in guided access.

是否可以通过引导访问检测到设备当前正在运行,以及对它启用或禁用做出反应?

Is it possible to detect that the device is currently running with guided access, and react to it being enabled or disabled?

推荐答案

你想要这样的东西:

NSLog(@"Accessabilitiy enabled: %@", UIAccessibilityIsGuidedAccessEnabled() ? @"YES" : @"NO");

if (!UIAccessibilityIsGuidedAccessEnabled()) {
   // show something since I'm not in guided access
}

如果你想知道它何时发生变化......

If you want to know when it changes...

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(guidedAccessChanged) name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];

然后根据第一次测试检查它是否开启或关闭。

then check to see if it is on or off as per the first test.

这篇关于检测或对Guided Access做出反应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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