4

I am making a custom keyboard and i want to change my keyboard layout to adapt to the UITextField type (url, websearch, email) every time user change the focus between textfields.

For example:

  • Beginning, user inputs in url textfield, my keyboard will show a dot button.
  • After finished the editing in url textfield, user focus on email textfield, my keyboard will replace a dot button by @ button.

The question is how to catch this even in custom keyboard?

TomSawyer
  • 3,711
  • 6
  • 44
  • 79
  • do you have your textfields in an interface builder? You can set the keyboard type straight in there. – dirtydanee Oct 21 '15 at 08:55
  • @dirtydanee i know, i can detect keyboard type at the beginning, but when user switch to other textfield , i can't detect that event to make a change to my keyboard layout to adapt to new keyboard type. – TomSawyer Oct 21 '15 at 08:56
  • do u have any sample code? – engmahsa Oct 21 '15 at 08:57
  • @engmahsa sample code? there's no need, i only need how to detect focus change event between textfields in custom keyboard. i can handle everything on my custom keyboard, but i need to catch focus change event. – TomSawyer Oct 21 '15 at 09:04
  • If you have several text field you can devide them with tag ang define keyboard type for each one in delegate – engmahsa Oct 21 '15 at 09:28
  • Yes as @engmahsa said , you can use tags for textfields depending on the tag of the current textfield the respective keyboard will be shown – Omkar Guhilot Oct 21 '15 at 09:46

0 Answers0