Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent custom keyboard in textfield

I was experimenting with how a custom keyboard affects my app. I installed Swype on my iPhone 6.

I find that in some of my views where I have custom inputView property set on a text field, the Swype keyboard is overriding and presenting instead of my picker. This completely breaks my UI and cannot be allowed.

Is there a way to explicitly tell iOS 8 only to use the inputView I have set?

Is this a bug, perhaps? It is not at all expected behavior to allow a third party to override my input spec?

like image 841
Dean Davids Avatar asked Sep 24 '14 15:09

Dean Davids


2 Answers

You can disable custom keyboard for your app with the following code:

include this in your app delegate:

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
    if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
        return NO;
    }
    return YES;
}
like image 193
eertl Avatar answered Oct 04 '22 06:10

eertl


Swift 4

  func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
        if (extensionPointIdentifier == .keyboard) {
            return false
        }
        return true
    }
like image 22
uplearned.com Avatar answered Oct 04 '22 06:10

uplearned.com