Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove change language key button from keyboard in iOS Swift 3

I want to remove change language key from my keyboard in iOS app with Swift3.enter image description here

like image 715
reza_khalafi Avatar asked Apr 28 '17 14:04

reza_khalafi


2 Answers

(Applies for iOS 10 or later)

Swift

Use .asciiCapable for Swift

txtField.keyboardType = .asciiCapable

Objective-C

self.txtField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
like image 180
Jack Avatar answered Sep 28 '22 02:09

Jack


You cannot remove a specific button from keyboard unless you create a custom keyboard. There are third party custom keyboards available that you can use in your app. You can manage behavior of custom keyboards also.

Another alternate option is: set keyboard type as ASCII Capable.

enter image description here

You can also set keyboard type programatically:

Swift 4:
yourTextField.keyboardType = .asciiCapable

Swift 3:
yourTextField.keyboardType = UIKeyboardType.asciiCapable

Objective C:
yourTextField.keyboardType = UIKeyboardTypeASCIICapable;
yourTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

like image 26
Krunal Avatar answered Sep 28 '22 01:09

Krunal