Skip to content
This repository was archived by the owner on Mar 9, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/UIBubbleTableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ typedef enum _NSBubbleTypingType
@property (nonatomic) NSBubbleTypingType typingBubble;
@property (nonatomic) BOOL showAvatars;

- (BOOL) scrollToBottomWithAnimation:(BOOL)animatedBool;

@end
18 changes: 18 additions & 0 deletions src/UIBubbleTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ - (void)reloadData
}

[super reloadData];

[self scrollToBottomWithAnimation:YES];
}

- (BOOL) scrollToBottomWithAnimation:(BOOL)animatedBool {
//Autoscroll to bottom of chat when reloadData called. Returns whether scroll actually occurred.

int sectionCount = [self numberOfSections];

if(sectionCount<=0) return NO;

int rowsInLastSection = [self numberOfRowsInSection:sectionCount-1];

NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:rowsInLastSection-1 inSection:sectionCount-1];
[self scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:animatedBool];

return YES;

}

#pragma mark - UITableViewDelegate implementation
Expand Down