Skip to content
This repository has been 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
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

soroushjp
Copy link

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.

soroushjp added 5 commits June 4, 2013 22:49
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.
@MindTheGap
Copy link

Thanks a lot for this.

I've been wondering how to implement auto scroll without learning all the BubbleTableView implementation!

@soroushjp
Copy link
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.

@v0idbring3r
Copy link

Hey, I am having a problem.
It doesn't let me scroll to bottom anytime.
As soon as i scroll to the bottom and release it, it automatically scrolls back to the middle.

If you have a solution or perhaps a reason for this occurrence, please help me.
Thanks in advance

@anuradhavasudeva
Copy link

@soroushjp solution does not work because there is still an issue with the function animateTextField.
img_1258

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

Successfully merging this pull request may close these issues.

4 participants