5

I would like to programmatically change keyboard when I click a button event.

I used custom keyboard in my app, but I need to change English (US) keyboard in programmatically when I click a button on my custom keyboard.

Cœur
  • 32,421
  • 21
  • 173
  • 232
Fire Fist
  • 6,911
  • 12
  • 59
  • 107

3 Answers3

3

The only way you can control the keyboard is by showing it (By setting a UITextView/UITextField as a first responder), hiding it (by resigning the editing Easy way to dismiss keyboard?).

The language of the keyboard cannot be changed by your app, since it is a user preference. If you want a custom keyboard of your own, you would have to design it yourself (with UIButtons) and obviously also program it (when it shows, when it hides. I would simply use the keyboard that the user prefers, why do you need to change it? After all, the user is the one that decides which keyboard he uses.

Community
  • 1
  • 1
Jorge Aguirre
  • 2,702
  • 3
  • 16
  • 25
3

I just got my answer for my own question.

Just put nil into inputView and that will change back into English (US) Keyboard.

Francisco C
  • 8,871
  • 4
  • 31
  • 41
Fire Fist
  • 6,911
  • 12
  • 59
  • 107
  • Hello, I have the same problem, what do you mean by inputType? – Hamid Oct 19 '13 at 15:27
  • I figured it out, yourTextfield.inputView = nil; – Hamid Oct 19 '13 at 15:36
  • Does this works just because your base language of the phone is English? What about if i have the Hindi language set as main phone's language and i want to set the English keyboard? – Mat Jun 05 '14 at 15:32
-4

You can change to the English (US) keyboard programmatically.

Try this:

textfield.secureTextEntry=YES;
textfield.secureTextEntry=NO;
Daniel
  • 17,803
  • 7
  • 74
  • 142
Tony
  • 1