如何在Swift中禁用第三方键盘? [英] How does one disable third party keyboards in Swift?

查看:353
本文介绍了如何在Swift中禁用第三方键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本就是这样,我没有找到一种方法来禁用我的应用程序中的第三方键盘,虽然我知道它可能'我在1Password等应用程序中看到它。

Basically that's it, I haven't found a way to disable third party keyboard in my app, although I know it's possible 'cos I've seen it in apps like 1Password.

任何想法?

推荐答案

AppDelegate

func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool {
    if extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier {
        return false
    }
    return true
}

Swift 4:

func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
    if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
        return false
    }
    return true
}

Apple reference

这篇关于如何在Swift中禁用第三方键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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