freshOS / KeyboardLayoutGuide

⌨️ KeyboardLayoutGuide, back from when it didn't exist.
MIT License
1.19k stars 59 forks source link

Fixes iOS 11 issue #9

Closed s4cha closed 6 years ago

s4cha commented 6 years ago

We have a set of signup screens that are pushed one after another.

Everything works fine if we call becomeFirstResponder() in viewDidAppear the keyboardWillChangeFrame is called and everything works as expected.

The thing is calling becomeFirstResponder in viewDidAppear animates the keyboard.

If we want to have the keyboard stay in position (already shown) in the screens, we can call becomeFirstResponder in viewDidLoad.

In iOS 11, the issue is that the keyboard notifications are not called if the keyboard is already on screen so we end up with the button under the keyboard. The underlying reason is that keyboardWillChangeFrame is not called on IOS11 if the keyboard stays shown between controllers, which seems quite logical actually.

The fix stores the previous keyboard height and sets in back up when setting up a new controller, only if the device is running iOS 11 :)

maxkonovalov commented 6 years ago

@s4cha do you think the iOS 11 check is necessary at all for the height caching? Having the height ready doesn't seem to be a bad idea, just need to make sure it works correctly on all versions.

s4cha commented 6 years ago

@maxkonovalov I agree, I narrowed it down to iOS 11 to be specific but as you point out, it adds unnecessary complexity.

maxkonovalov commented 6 years ago

👍