How do you disable a 3rd party keyboard in your iOS app

好久不见. 提交于 2020-06-25 18:36:25

问题


Can you disable 3rd party keyboards in iOS?

If so, how?


回答1:


Add this method to your UIApplicationDelegate

-(BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier
    {

        if (extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier)
        {
            return NO;
        }

        return YES;
    }



回答2:


Swift 5.1

Add to AppDelegate.Swift:

func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool {
    if (extensionPointIdentifier == UIApplication.ExtensionPointIdentifier.keyboard.rawValue) {
        return false
    }

    return true
}


来源:https://stackoverflow.com/questions/28108659/how-do-you-disable-a-3rd-party-keyboard-in-your-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!