Strange gap between keyboard and input field on iOS

Hi,

We’ve been having a strange issue with a gap appearing between input fields and the text entry area on an app we’re developing. Occurs at random, and only about 2% of the time. We think it only started after updated from 4.6 to 5.1, but as it is occasional and random we don’t know for sure.

Any ideas on what could be causing this??

I’m seeing the same issue. However, I get it almost 100% of the time.

This isnt related to the new UI, I’d post it in the ios forums they might have an idea.

After some investigation, the gap is a result of having the status bar shown (Player Settings > Resolution and Presentation > Status Bar). The gap is the size of the status bar. I’ll enter enter this as a bug (Unity could at least hide the status bar while the keyboard is open).

2 Likes

Hi!

Any workaround for this issue?

Thanks in advance.

This problem is due to the translucent status bar. I think that it is probably a bug.
Translucent status bar should be calculated as the height 0, because it have full overlap with area of content.
However, the actual build results is…

See: Xcode project> Unity-iPhone> Classes> UI> Keyboard.mm> [Method] positionInput: x: y;
CGRect statusFrame = [UIApplication sharedApplication] .statusBarFrame;
unsigned statusHeight = statusFrame.size.height;

As a result, the position of the editView.frame is deviated just the height of the status bar.
If you are using a translucent status bar, it is possible to erase the strange gap by editing the Keyboard.mm as follows.

unsigned statusHeight = 0;

Excuse me in my poor English.

I’ve written a patch plugin to fix this problem.
Please try it.

https://github.com/miyabi/unity-ios-keyboard-patch