diff options
author | Vitaly Takmazov | 2017-12-09 23:47:30 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-09 23:47:30 +0300 |
commit | a38541e14ecfea8e37c80755fb3b2ef25cd81272 (patch) | |
tree | 3b26f5e4f86a4eb103193535abf7f9b15e0e67e6 /Juick/ViewControllers/MessagesViewController.m | |
parent | e2ac87809468e9487389e5d22ab9766996898478 (diff) |
working post/reply
Diffstat (limited to 'Juick/ViewControllers/MessagesViewController.m')
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 80e8c73..823d838 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -23,7 +23,11 @@ @implementation MessagesViewController -- (void) refreshData { +-(void) refreshData { + [self refreshData:NO]; +} + +-(void) refreshData:(BOOL)scrollToBottom { self.dataLoading = YES; [[APIClient sharedClient] pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) { NSArray *newMsgs = next; @@ -49,6 +53,10 @@ [self.tableView endUpdates]; [self.refreshControl endRefreshing]; self.dataLoading = NO; + if (scrollToBottom) { + NSIndexPath *lastRow = [NSIndexPath indexPathForRow:self.messages.count - 1 inSection:0]; + [self.tableView scrollToRowAtIndexPath:lastRow atScrollPosition:UITableViewScrollPositionBottom animated:YES]; + } }]; } @@ -75,7 +83,7 @@ if ([self.path length] == 0) { self.path = [APIClient feedUrl]; } - [self refreshData]; + [self refreshData:NO]; } else { [User throwUnableToLogin:self]; } @@ -85,7 +93,7 @@ if ([self.path length] == 0) { self.path = [APIClient messagesUrl]; } - [self refreshData]; + [self refreshData:NO]; } } @@ -119,7 +127,7 @@ if (![self.path isEqualToString:[APIClient threadUrl]]) { self.params = [@{@"before_mid":lastMid} mutableCopy]; } - [self refreshData]; + [self refreshData:NO]; } } } |