Incorrect Scrolling on iOS 11
uddinr opened this issue ยท 27 comments
on ios 11 the scrolling for the attached example is incorrect, the navigation bar ends up off the top of the screen, once the keyboard is dismissed a big gap is left at the top of the screen between the image view and the navigation controller
i am using IQKeyboardManagerSwift 4.0.13 installed via cocoapods
Storyboard View
Initial View
Keyboard Shown
Keyboard Dismissed
Having a very similar issue. Hopefully they can implement a fix quickly.
I have this issue too.
Having the same problem
Having the same problem
The latest version will have the same problem
Having the same problem
same problem
I'm having the same problem too.
Short Answer
Potential workaround/short term fix I have come across is to use IQKeyboardManager
instead of IQKeyboardManagerSwift
and then essentially embed everything inside a UIScrollView
.
Detailed Answer
Note: This fix doesn't seem to work with IQKeyboardManagerSwift
, only with IQKeyboardManager
, but as far as I'm aware IQKeyboardManager
should still work in Swift projects.
You need to embed everything in your view inside both a UIView
and then this within a UIScrollView
.
So currently your view hierarchy may look like this.
-- Outermost UIView
----- Element inside view
----- Element inside view
----- Element inside view
----- etc.
You want to change this to be:
-- Outermost UIView
----- UIScrollView
--------- Inner UIView
------------ Element inside view
------------ Element inside view
------------ Element inside view
------------ etc.
Although this is now all within a UIScrollView
, if your contents are not greater in size than the screen size it should not be scrollable so the end user won't see any noticeable difference.
For a more detailed look at how best to set up this UIScrollView
hierarchy take a look here. This is how I have my hierarchy setup and it seems to be working.
Hopefully this works for some others! Let me know.
@uddinr can you please share demo project with us. I would like to know why this is happening with swift version and why it's not with objc version.
Thanks @kierobinson1 for detailed explanation, but if this is a bug then we should fix it.
@hackiftekhar example project attached, issue occurs on ios 11 in simulator seems fine on ios 10 simulator
THANks for the demo @uddinr, Iโll look at this in weekend.
I am having the scrolling issue, also.
I found two issues
- You are using UIScrollView, so if you do so then make sure to add constraints which can tell scrollView contentSize.
- I'm seeing a new thing called
Safe Area
and I'm not aware about how we'll deal with this. This might take time for me to understand working ofSafe Area
.
even if i remove the UIScrollView and use a UIView the same issue exists
That's why I put second comment related to Safe Area
@kierobinson1 - your solution worked for me. Having so many view layers will probably not be everyone's favourite, but as a workaround it's good enough for now - it makes things work how they're supposed to :)
@aurora14 Yeah, it was just meant to be a workaround for the mean time until @hackiftekhar can get a fix out.
i am using tableview and face this problem
any update on this issue? i am currently using IQKeyboardManagerSwift 4.0.13 and the issue persists
I wrapped the screen with UIScrollView and pod works fine.
i understand that it works by embedding all controls within a scrollview but i think doing that defeats the purpose of using this library i think it should be fixed to work the same way as iOS 10 i will await for any fixes for now
You are absolutely correct @uddinr. ScrollView shouldn't be require to fix this problem (but for now a workaround). There are too many layout related API's are changed with iOS11.
Technically iOS11 following too many layout guides and layout margins which affect most of the library logic. Fixing those issues are taking time because I need to properly understand how new iOS11 layouts are related to each other and how they affect position of contents.
it still dosent work in 2018 !!!
It's fixed with new solution, changes are in master
branch now.