summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-08-15 21:25:35 +0300
committerGravatar Vitaly Takmazov2016-08-15 21:25:35 +0300
commit392e98ba3c4b3e4a01bf475794d23c26e20d654a (patch)
tree1bbcf7e0b55bfac73d3abf87757338fe007f8d09 /Juick
parent9d2b52bb9ee096c546028bd0257944cade21ab4e (diff)
YYWebImage
Diffstat (limited to 'Juick')
-rw-r--r--Juick/Juick-Prefix.pch2
-rw-r--r--Juick/MessagesViewController.m9
-rw-r--r--Juick/Views/MessageCell.m2
-rw-r--r--Juick/Views/MessageCell.xib2
4 files changed, 11 insertions, 4 deletions
diff --git a/Juick/Juick-Prefix.pch b/Juick/Juick-Prefix.pch
index 7836550..c48dc95 100644
--- a/Juick/Juick-Prefix.pch
+++ b/Juick/Juick-Prefix.pch
@@ -15,7 +15,7 @@
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
- #import <UIImageView+DFImageManager.h>
+ #import <YYWebImage.h>
#import "NSString+HTML.h"
#import "UIImage+Utils.h"
#import "NSDate+TimeAgo.h"
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 91833e1..343bb2c 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -129,7 +129,14 @@ static NSString *CellIdentifier = @"MessageCell";
Message *msg = [_messages objectAtIndex:indexPath.row];
[cell setMessage:msg];
if ([msg.attach length] > 0) {
- [cell.attach df_setImageWithResource:[NSURL URLWithString:msg.attach]];
+ __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];
+ }];
+
} else {
cell.attach.image = nil;
}
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m
index 65565a8..7117052 100644
--- a/Juick/Views/MessageCell.m
+++ b/Juick/Views/MessageCell.m
@@ -23,7 +23,7 @@
- (void) setMessage:(Message *)msg {
_message = msg;
- [self.avatar df_setImageWithResource:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [msg.userID intValue]]]];
+ self.avatar.yy_imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [msg.userID intValue]]];
self.title.text = msg.user;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib
index 29f37fb..5cbf69d 100644
--- a/Juick/Views/MessageCell.xib
+++ b/Juick/Views/MessageCell.xib
@@ -52,7 +52,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="53j-SC-IXj">
+ <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="53j-SC-IXj">
<rect key="frame" x="0.0" y="249" width="50" height="50"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zDd-8E-ic8">