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

Specify end position for -scrollToObject #139

Closed
yusuftor opened this issue Oct 29, 2016 · 5 comments
Closed

Specify end position for -scrollToObject #139

yusuftor opened this issue Oct 29, 2016 · 5 comments
Milestone

Comments

@yusuftor
Copy link

The current implementation of -scrollToObject doesn't allow you to specify where you would like the section to be positioned at the end of the scroll. With Apple's implementation of -scrollToItem for a collectionView, they have a parameter called scrollPosition. This allows a user to specify whether the item should be positioned at the top, bottom, center etc. of the view.

It would be great if this feature could be implemented. For example, I want to be able to scroll to the very last cell, with the cell positioned at the bottom, when the keyboard is presented.
Thanks!

@rnystrom
Copy link
Contributor

Absolutely. I've had this request internally too. We'll have to decide on whether or not this is a breaking change or not. Also we should get all the tests from #23 in place before doing this.

@zhubofei
Copy link

zhubofei commented Nov 10, 2016

@rnystrom This may be a silly question. But why we need to calculate the cell position manually inside -scrollToObject instead of calling -scrollToItemAtIndexPath:atScrollPosition:animated directly?

@rnystrom
Copy link
Contributor

@zhubofei in the case that you have a supplementary view at the beginning/end of your section and you want to scroll to the top of it. This happens in Instagram when we want to scroll to an item but align the top offset at the beginning of the supplementary view.

We could probably simplify a lot of this API though, or maybe split it out into other parts.

@zhubofei
Copy link

Still need unit test case for horizontal scrolling.

@jessesquires
Copy link
Contributor

Done in #196. Closing.

Unit tests follow-up: #238

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

No branches or pull requests

4 participants