In my iOS app, when the user click on a UITextfield
I need to change the keyboard view to the numeric view automatically. I write below code and it is working fine.
UITextField *txtfield = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
txtfield.keyboardType = UIKeyboardTypeNumberPad;
My app supports localization. I added 4 keyboards on the device like English, Spanish, Hindi, Emoji. I want disable or hide localization in number keyboard type. Please see attached image. I have highlighted in red box.
Anyone knows how to do that?
(Applies for iOS 10 or later)
Swift
Use .asciiCapableNumberPad
for Xcode 8.3/Swift 3.1 for only numbers
txtField.keyboardType = .asciiCapableNumberPad
Objective-C
txtField.keyboardType = UIKeyboardTypeASCIICapableNumberPad