IdleHandsApps / IHKeyboardAvoiding

IHKeyboardAvoiding is an elegant solution for keeping any UIView visible when the keyboard is being shown - no UIScrollView required!
MIT License
1.41k stars 151 forks source link

Demo is broken in iOS 8. #5

Open klauslanza opened 10 years ago

klauslanza commented 10 years ago

Demo is broken in iOS 8 ipad device, the view don't scroll back after the keyboard dismissal. I have problem also using in a project of mine, I'm trying to figure out where is the problem. Any idea already tried?

fraserscottmorrison commented 10 years ago

I haven't run the demo for a long time... I look into it next week

Is you view using Springs and Struts or Autolayout? And if Autolayout, are you applying them programatically or in IB?

Cheers Fraser

defagos commented 10 years ago

There are a few issues with keyboard undocking in iOS 8 (most notably the UIKeyboardWillHideNotification is not sent correctly when the keyboard is undocked). See http://openradar.appspot.com/18010127 for more information.

klauslanza commented 10 years ago

Is you view using Springs and Struts or Autolayout? And if Autolayout, are you applying them programatically or in IB?

I'm using spring and struts.

Regarding the demo: Using the iPad simulator 7.1 works both in landscape and portrait, 8 in landscape is quite working (sometimes the frames are off) but in portraits the view remains scrolled even after the keyboard is dismissed or just blows all the way up. Check this Vine I did https://vine.co/u/907571708674846720

fraserscottmorrison commented 10 years ago

Klauslanza, can you check that your target view is near the bottom of the screen. The target view needs to be obscured by keyboard to trigger the avoiding.

I hadn't done any iOS8 iPad testing - sounds like there's a bug - I'll look into it next week. Thanks guys for raising the issue.

defagos commented 10 years ago

iOS 8 keyboard is seriously flawed. I could dig a little bit deeper to better understand those issues, here is what I found.

If you split, merge, dock or undock the keyboard by long-pressing the ⌨ key and choosing the corresponding option, the keyboard seems behaves correctly as on iOS 7, besides a few graphical glitches. It is when you start moving the keyboard around with the ⌨ key pressed that many issues arise:

I gave the class-dumped headers a deeper look, even tried some swizzling and private API calls for fun, but I could not solve all those issues at the same time. The iOS 8 keyboard implementation is far more complex than iOS 7 one, and currently seems like a buggy mess.

I suggest you should not lose too much time trying to fix the issues above. All official information you know about the keyboard stems from notifications, and you cannot do much to fix related issues without using private APIs. Instead: