Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard showing up for iOS app but text field not responding (keyboard buttons not either)

I have a UITextField which is being set as first responder, and I have verified afterwards that it has been set as the first responder, and the keyboard pops up as well.

However when I try to type on the keyboard nothing is entered into it, and furthermore the keys do not light up either.

A really strange thing is when I plug in a bluetooth physical keyboard I am able to enter in characters in the field! Then when I shut off my keyboard and the virtual keyboard comes up again I cannot type.

I've searched around the internet for solutions for this but no avail. I am calling makeKeyAndVisible for my UIWindow which was a suggested solution by someone.

like image 875
Locksleyu Avatar asked May 02 '14 15:05

Locksleyu


2 Answers

I had a similar issue. My problem was the main view frame of the key window is smaller than the window bounds, so the virtual keyboard was actually outside the main view frame. Tapping on the virtual keyboard does absolutely nothing.

What I would do: 1. Check for the frame for the main view of the key window. 2. Check whether root view controller is assigned to the key window.

I had this issue on an old codebase for an iPad application which had no root view controller for the main window and thus would not resize properly after rotating.

It might be worth checking out.

like image 199
Sani Avatar answered Oct 25 '22 14:10

Sani


First thing you can try is to press the command key by itself, release it and then start typing. Sometimes this can enable the keyboard in the simulator.

If the previous step failed, If you are using a simulator, sometimes there will be issues with the keyboard. To verify it is not your code, run on an actual device and test.

If it works on the device, then clean the project, reset the simulator, close the simulator, restart XCode, try again.

If the problem persists, do the same steps above, but reset the computer before starting up XCode again.

like image 25
William Falcon Avatar answered Oct 25 '22 14:10

William Falcon