nlampi / SwiftGridView

Swift based data grid view.
MIT License
58 stars 15 forks source link

Scroll to top #27

Closed robcecil closed 6 years ago

robcecil commented 7 years ago

Hello @nlampi I am trying to scroll to the top of the grid via:

self.dataGridView.scrollToCellAtIndexPath(IndexPath(forSGRow: 0, atColumn: 0, inSection: 0), atScrollPosition: .top, animated: true)

But it won't budge.

I previously tried setting scrollsToTop to true, but i have other UIScrollViews in the main interface and I think that would be an issue. So, I am trapping taps on the status bar, and my app's main toolbar and manually calling the method above.

Any ideas?

Thanks

nlampi commented 7 years ago

Are you using frozen rows when having this issue? I am trying a few things to reproduce the error and see that frozen rows can cause issues with scrolling (to the frozen row).

robcecil commented 7 years ago

Yes I am. Should have thought of that! So I should instead just compute the proper row and try scrolling to that?

nlampi commented 7 years ago

I am testing out a few things, but scrolling right now doesn't seem to work as expected when using headers. I will also see about adding the ability to explicitly set the offset.

nlampi commented 7 years ago

I have released version 0.5.2 which addresses the scrolling issue mentioned here. You should now be able to scroll to frozen columns/rows as well as use positional items to scroll properly. I have also exposed setting the content offset manually for greater control. Please test and let me know if you have issues still.

robcecil commented 7 years ago

Okay, just to be clear, I should be able to scroll to 0,0,0 and not have worry about frozen rows or cells, ... it will just figure it out and do it ?

nlampi commented 7 years ago

Yep, it should take into account the real/correct position of the frozen row and scroll to that origin.

robcecil commented 6 years ago

Works great. Thanks!

robcecil commented 6 years ago

@nlampi

FYI, looks like you have a print() statement somewhere, print something like this:

***(0.0, 0.0, 105.0, 40.0)