summaryrefslogtreecommitdiff
path: root/Juick/MessagesViewController.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/MessagesViewController.m')
-rw-r--r--Juick/MessagesViewController.m20
1 files changed, 12 insertions, 8 deletions
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 343bb2c..28e7613 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -48,10 +48,12 @@ static NSString *CellIdentifier = @"MessageCell";
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
self.dataLoading = YES;
[Message pullNextFromPath:self.path params:self.params callback:^(NSArray *next) {
- [self.messages addObjectsFromArray:next];
- [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
- [self.refreshControl performSelectorOnMainThread:@selector(endRefreshing) withObject:nil waitUntilDone:NO];
- self.dataLoading = NO;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.messages addObjectsFromArray:next];
+ [self.tableView reloadData];
+ [self.refreshControl endRefreshing];
+ self.dataLoading = NO;
+ });
}];
});
}
@@ -131,10 +133,12 @@ static NSString *CellIdentifier = @"MessageCell";
if ([msg.attach length] > 0) {
__weak MessagesViewController * weakSelf = self;
[cell.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] placeholder:[UIImage imageNamed:@"AttachPlaceholder"] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
- [cell setNeedsUpdateConstraints];
- [cell updateConstraintsIfNeeded];
- [cell setNeedsLayout];
- [cell layoutIfNeeded];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [cell setNeedsUpdateConstraints];
+ [cell updateConstraintsIfNeeded];
+ [cell setNeedsLayout];
+ [cell layoutIfNeeded];
+ });
}];
} else {