I want to create a custom keyboard, and I want to add more characters on it. if user long press a button it show more characters. like IOS default keyboard shows popup button after long press.
1 Answers
I created a very complex keyboard a few months ago where every key needed to have at least 5 different variations (Amharic dialect). I found that many pop ups do not work very well as they don't pop up over the top of the keyboard, I looked at how other keyboards achieved this but couldn't find a way to make it work. You can see a question on this problem here.
As a work around I created my custom keyboard with an extra row on the top, this was normally filled with numbers but on a long press would switch to show the alternative keys available. On long press the key pressed would be added to the field and if they chose on of the alternatives it would then replace the first key.
To give you a better idea here are some images:
Regular Keyboard:
Long press:
NOTE: Excuse the poor quality but I could only find an intermediate version of the project to screen print.
While working on this project I found that pop ups were a lot more difficult to achieve than this. I researched creating my own pop ups with bezier paths and also using pop ups themselves with the CYRKeyboard Button. (Note although the CYR gif shows the exact functionality required I found this gif to be extremely misleading). But in the end I came back to the above solution which worked very smoothly, quickly and easily.
Hope this helps
-
Thanks, Your keyboard is looking great. And I am new in swift. I also have the problem with constraints and auto layout.. any suggestion regard this? – J. Doe Oct 04 '16 at 00:30
-
If this answer has answered your question then you should mark it as the correct answer. It would then be worth searching SO for potential answers on constraints and auto layout before posting a separate question on it. I did mine using constraints so it would automatically update when the screen turned and remember it being complicated. Here is a question i posted that might help: http://stackoverflow.com/questions/29598009/how-can-i-programatically-constrain-uibuttons-in-a-uiview-to-proportional-widths – sam_smith Oct 04 '16 at 00:33