Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)scrollToBottomOfMessagesAnimated:(BOOL)animated {
- if (self.room.messages.count > 0 && [self.manager count] == 0) {
- [self updateManagerForChats];
- }
- NSInteger x = [self.messagesTableView numberOfRowsInSection:0] - 1;
- NSInteger y = [self.manager count]; // Doing this because the operations are at the end always
- if (x <= 0 || y <= 0) {
- [self.messagesTableView setContentOffset:CGPointMake(0, CGFLOAT_MAX)];
- } else {
- NSInteger rowNumbers = [self.messagesTableView numberOfRowsInSection:0]-1;
- dispatch_after(0, dispatch_get_main_queue(), ^{
- [self.messagesTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.messagesTableView numberOfRowsInSection:0]-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO];
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement