This repository was archived by the owner on Mar 9, 2018. It is now read-only.
Autoscroll added, automatically moves to bottom of chat UIBubbleTableView when reloadData is called.#45
Open
soroushjp wants to merge 5 commits intoAlexBarinov:masterfrom
Open
Autoscroll added, automatically moves to bottom of chat UIBubbleTableView when reloadData is called.#45soroushjp wants to merge 5 commits intoAlexBarinov:masterfrom
soroushjp wants to merge 5 commits intoAlexBarinov:masterfrom
Conversation
For me, I wanted my chat to scroll to bottom on arrival of a new message. Conveniently, this is when reloadData is called, so until a developer options list is made available, this seems like a great solution for most use cases.
Could be reused in other cases (eg. after resizing of UITableView)
…ed out to instance method with optional scroll animation
…tional animation and added prototype to header file.
Amended commit message
|
Thanks a lot for this. I've been wondering how to implement auto scroll without learning all the BubbleTableView implementation! |
Author
|
No worries, glad it helped. I'm working a lot with this library in my project and have been through the implementation so let me know if you run into any other issues. |
|
Hey, I am having a problem. If you have a solution or perhaps a reason for this occurrence, please help me. |
|
@soroushjp solution does not work because there is still an issue with the function animateTextField. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For me, I wanted my chat to scroll to bottom on arrival of a new message. Conveniently, this is when reloadData is called, so until a developer options list is made available, this seems like a great solution for most use cases.
If this would be better served as an optional parameter, I can code it up, just let me know.
EDIT: I refactored this code out as a scrollToBottom instance method. This could make sense as a function left accessible for the user so they can call it as needed, instead of building an autoscroll option or forcing it on people using the library. Just an idea. For now, left in reloadData method to act as autoscroll.
EDIT2: For my own application, I needed a place without animation during scrolling, so I extended this method to scrollToBottomWithAnimation:(BOOL)animated. I then put this in the header as an accessible method for the rest of my controllers. If this seems useful, let me know, I will submit a separate pull request.
EDIT3: I added the optional animation code and added method prototype to header. Let me know if this is not the route you want to take with the project.