diff options
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.h | 1 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Juick/ViewControllers/DialogsViewController.h b/Juick/ViewControllers/DialogsViewController.h index c37f6a6..f31830e 100644 --- a/Juick/ViewControllers/DialogsViewController.h +++ b/Juick/ViewControllers/DialogsViewController.h @@ -11,5 +11,6 @@ @interface DialogsViewController : UITableViewController @property(nonatomic, strong) NSMutableArray *chats; +-(void) refreshData; @end diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index d080176..e801627 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -20,7 +20,14 @@ self.navigationController.visibleViewController.navigationItem.title = @"Chats"; [self.view setBackgroundColor:[ColorScheme mainBackground]]; [self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"]; + [self refreshData]; + self.refreshControl = [UIRefreshControl new]; + [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; +} + +- (void) refreshData { self.chats = [NSMutableArray array]; + [self.tableView reloadData]; [[APIClient sharedClient] fetchChats:^(NSArray *groups, NSError *err) { if (err == nil) { [self.chats addObjectsFromArray:groups]; @@ -31,6 +38,7 @@ [self.tableView beginUpdates]; [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:YES]; [self.tableView endUpdates]; + [self.refreshControl endRefreshing]; } }]; } |