summaryrefslogtreecommitdiff
path: root/Juick/MessagesViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-22 00:44:28 +0300
committerGravatar Vitaly Takmazov2016-08-22 00:44:28 +0300
commita74588083c4950e9237dff7a84ccdd129b72c950 (patch)
treee2ac66b8b3028fe09d6046a1ae4c80bcf2f85e14 /Juick/MessagesViewController.m
parent392e98ba3c4b3e4a01bf475794d23c26e20d654a (diff)
RestKit -> YYModel
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 {