Skip to content
This repository has been archived by the owner on Mar 9, 2018. It is now read-only.

Commit

Permalink
Added public method for scrolling UIBubbleTableView to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
mast committed Sep 4, 2013
1 parent 2fd8684 commit 7a7c232
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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;

- (void) scrollBubbleViewToBottomAnimated:(BOOL)animated;

@end
13 changes: 13 additions & 0 deletions src/UIBubbleTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell;
}

#pragma mark - Public interface

- (void) scrollBubbleViewToBottomAnimated:(BOOL)animated
{
NSInteger lastSectionIdx = [self numberOfSections] - 1;

if (lastSectionIdx >= 0)
{
[self scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:([self numberOfRowsInSection:lastSectionIdx] - 1) inSection:lastSectionIdx] atScrollPosition:UITableViewScrollPositionBottom animated:animated];
}
}


@end

2 comments on commit 7a7c232

@InfAspire
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mast - Your method doesn't work for me if the table isn't filling the screen. This is what I am using instead, I was considering modifying the codebase to use this instead, can you verify this works for you? No need for an if or any conditions to use this method.

[self setContentOffset:CGPointMake(0, (self.contentSize.height - self.bounds.size.height)) animated:animated];

@mayooresan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow. I was thinking how to implement this and came across this public method. Thanks. Worked like charm.

Please sign in to comment.