Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Scrolling on iOS 11 #972

Closed
uddinr opened this issue Sep 20, 2017 · 27 comments
Closed

Incorrect Scrolling on iOS 11 #972

uddinr opened this issue Sep 20, 2017 · 27 comments
Milestone

Comments

@uddinr
Copy link

uddinr commented Sep 20, 2017

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

screen shot 2017-09-20 at 14 42 26

Initial View

simulator screen shot - iphone se - 2017-09-20 at 14 41 00

Keyboard Shown

simulator screen shot - iphone se - 2017-09-20 at 14 37 49

Keyboard Dismissed

simulator screen shot - iphone se - 2017-09-20 at 14 38 41

@meismyles
Copy link

Having a very similar issue. Hopefully they can implement a fix quickly.

@Akaqlonist
Copy link

I have this issue too.

@Raphzz
Copy link

Raphzz commented Sep 20, 2017

Having the same problem

1 similar comment
@ssj1314
Copy link

ssj1314 commented Sep 21, 2017

Having the same problem

@Antduo
Copy link

Antduo commented Sep 21, 2017

The latest version will have the same problem

@CDYeah
Copy link

CDYeah commented Sep 21, 2017

Having the same problem

@Shahbaz-Akram
Copy link

same problem

@kierobinson1
Copy link

I'm having the same problem too.

@kierobinson1
Copy link

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.

@hackiftekhar
Copy link
Owner

@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.

@hackiftekhar
Copy link
Owner

Thanks @kierobinson1 for detailed explanation, but if this is a bug then we should fix it.

@uddinr
Copy link
Author

uddinr commented Sep 21, 2017

@hackiftekhar example project attached, issue occurs on ios 11 in simulator seems fine on ios 10 simulator

ScrollingIssue.zip

@hackiftekhar
Copy link
Owner

THANks for the demo @uddinr, I’ll look at this in weekend.

@zzipdog
Copy link

zzipdog commented Sep 22, 2017

I am having the scrolling issue, also.

@hackiftekhar
Copy link
Owner

I found two issues

  1. You are using UIScrollView, so if you do so then make sure to add constraints which can tell scrollView contentSize.
  2. 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 of Safe Area.

@uddinr
Copy link
Author

uddinr commented Sep 22, 2017

even if i remove the UIScrollView and use a UIView the same issue exists

@hackiftekhar
Copy link
Owner

That's why I put second comment related to Safe Area

@aurora14
Copy link

@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 :)

@kierobinson1
Copy link

kierobinson1 commented Sep 25, 2017

@aurora14 Yeah, it was just meant to be a workaround for the mean time until @hackiftekhar can get a fix out.

@Shahbaz-Akram
Copy link

i am using tableview and face this problem

@uddinr
Copy link
Author

uddinr commented Oct 2, 2017

any update on this issue? i am currently using IQKeyboardManagerSwift 4.0.13 and the issue persists

@Akaqlonist
Copy link

I wrapped the screen with UIScrollView and pod works fine.

@uddinr
Copy link
Author

uddinr commented Oct 2, 2017

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

@hackiftekhar
Copy link
Owner

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.

@whlsxl
Copy link

whlsxl commented Oct 26, 2017

@uddinr the demo does not work...😢

@nthrussell
Copy link

it still dosent work in 2018 !!!

@hackiftekhar hackiftekhar added this to the v6.0.0 milestone Mar 12, 2018
@hackiftekhar
Copy link
Owner

It's fixed with new solution, changes are in master branch now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests