-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
CollectionView does not scroll to last item when not visible item #14
Comments
Hi @deehegarty Thank you for the issue. Can you explain me some details. Current Example app does not scroll to the bottom of the collection view after the new message is sent. Or if it does - it is a side effect of some other action. Is that the issue within your modification?
|
I should give some details here. If you require to scroll to some specific cell - you should use So, in the current example app. If you require to scroll to the bottom of the collection view every time user sends a message - it needs to be modified this way:
But, be aware: If you are using |
@deehegarty Please let me know if you are satisfied with the answer. If you have any other question - please do not hesitate to ask. |
@ekazaev Thanks so much for this information (some really good info here). What I had inside |
@deehegarty I think its just a misleading name of the method. I use it only to adjust the offset the the size of input view changes, it usually happens within the visible zone, so for me those nuances are not critical. Ill update the Example app to avoid the confusion. |
@ekazaev Thanks so much for the clarification 😃 |
@deehegarty JFYI: The example app was recently updated to demonstrate one of the possible implementations of your request |
Expected behaviour:
When a user sends a message and taps on the send button, the should be a scroll to the last item in the CollectionView.
Actual behaviour:
When a user sends a message and taps on the send button, the CollectionView will scroll to show the just top of the last item.
It appears to be taking the estimated item size instead of the actual size of the new cell that has just been sent by the end user. The cell is added to the view and can be seen once you manually scroll to the bottom. Example: when we increased the estimated item height to 100, the scrolling was correct, but only for smaller messages. If it was a bigger message, it would be cut off after 100 height.
Something to note is that the above behaviour occurs when
animation = true
when scrolling i.e.self?.collectionView.setContentOffset(contentOffsetAtBottom, animated: true)
. Whenanimation = false
the CollectionView will scroll to the correct position.Reproduction steps:
Note:
scrollToBottom()
is not currently working in the Example app providedThe text was updated successfully, but these errors were encountered: