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

Horizontal scrolling in long vertical tableView causes the outer table to jump #3866

Closed
gklka opened this issue Feb 25, 2019 · 2 comments
Closed

Comments

@gklka
Copy link

gklka commented Feb 25, 2019

[*] I've read, understood, and done my best to follow the *CONTRIBUTING guidelines.

What did you do?

I have a zoomable LineChartView in my UITableView.

What did you expect to happen?

I expected the outer table view not to scroll (jump) vertically when I started scrolling the chart.

What happened instead?

I the outer table view jumped ~44 pt vertically when I started scrolling the chart. This was caused by Platform.swift:155 isScrollEnabled = true.

Charts Environment

Charts version/Branch/Commit Number: 3.2.2
Xcode version: 10.1
Swift version: Objective-C and
Platform(s) running Charts: iOS
macOS version running Xcode: 10.14.3

Demo Project

simulator screen shot - iphone 8 - 2019-02-25 at 15 52 17

https://imgur.com/a/mgFw2Nl

@liuxuan30
Copy link
Member

take a look at panGestureRecognized(_ recognizer: NSUIPanGestureRecognizer)

                    if _outerScrollView !== nil
                    {
                        // Prevent the parent scroll view from scrolling
                        _outerScrollView?.nsuiIsScrollEnabled = false
                    }

it should be disabled already. But I don't know what's going on on your side. Please debug a little

@CodeStrumpet
Copy link

Hi @gklka I was experiencing the same thing when panning my LineChartView that was within a tableview. Not sure if this is relevant to your situation but in my case I found that it was related to the tableview automatically adjusting the content insets. When I set the contentInsetAdjustmentBehavior property of the tableview to "never", the problem stopped happening, however my tableview content was now occluded by my navigation bar.

self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;

What I discovered is that when I allocated my tableview I had set its frame to my view bounds which placed it under my navigation bar. Because the content insets were being updated automatically, none of my tableview cells were occluded by the navigation bar however I was experiencing the vertical jump that you mentioned when panning my chart.

Ultimately I found the best solution for me was to re-enable the automatic content inset adjustment behavior, but correctly set the origin Y of my tableview frame to be below my navigation bar.

@gklka gklka closed this as completed Jul 7, 2019
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

3 participants