summaryrefslogtreecommitdiff
path: root/Juick/MessagesViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-11-10 15:56:03 +0400
committerGravatar Vitaly Takmazov2013-11-10 16:02:25 +0400
commitb60aec3598a12a5bf07ad490fa87723e308cd58b (patch)
tree412c9b1335102219c411f48bc711be58f63846c0 /Juick/MessagesViewController.m
parentc7ac059a7e59ff3da4f88c53bedae29655ae900c (diff)
Images
Diffstat (limited to 'Juick/MessagesViewController.m')
-rw-r--r--Juick/MessagesViewController.m37
1 files changed, 4 insertions, 33 deletions
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 2e27d43..372345a 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -18,7 +18,7 @@
#import "NSURL+PathParameters.h"
-#import "UIImage+Helpers.h"
+#import <SDWebImage/UIImageView+WebCache.h>
static NSString *CellIdentifier = @"MessageCell";
@@ -158,23 +158,7 @@ static NSString *CellIdentifier = @"MessageCell";
MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
[cell updateFonts];
Message *msg = [_messages objectAtIndex:indexPath.row];
- [UIImage loadFromURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]] callback:^(UIImage *image) {
- [cell.avatar setImage:image];
- }];
- cell.titleLabel.text = msg.user;
- cell.titleLabel.textColor = [ColorsAndButtons linkColor];
- cell.timestampLabel.text = msg.timestamp;
- if (msg.repliesCount > 0) {
- cell.summaryLabel.text = [NSString stringWithFormat:@"%@ replies by %@", msg.repliesCount, msg.repliesBy];
- } else {
- cell.summaryLabel.text = nil;
- }
- cell.bodyLabel.text = [msg.text stringByDecodingHTMLEntities];
- if ([msg.tags count] > 0) {
- cell.bodyLabel.text = [[NSString alloc] initWithFormat:@"%@\n%@", [msg.tags componentsJoinedByString:@", "],
- [msg.text stringByDecodingHTMLEntities]];
- }
- [cell setBackgroundColor:[UIColor whiteColor]];
+ [cell bind:msg];
[cell setNeedsUpdateConstraints];
return cell;
}
@@ -188,22 +172,9 @@ static NSString *CellIdentifier = @"MessageCell";
[cell updateFonts];
Message *msg = [_messages objectAtIndex:indexPath.row];
- [UIImage loadFromURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]] callback:^(UIImage *image) {
- [cell.avatar setImage:image];
- }];
- cell.titleLabel.text = msg.user;
- cell.timestampLabel.text = msg.timestamp;
- if (msg.repliesCount > 0) {
- cell.summaryLabel.text = [NSString stringWithFormat:@"%@ replies by %@", msg.repliesCount, msg.repliesBy];
- } else {
- cell.summaryLabel.text = nil;
- }
- cell.bodyLabel.text = [msg.text stringByDecodingHTMLEntities];
- if ([msg.tags count] > 0) {
- cell.bodyLabel.text = [[NSString alloc] initWithFormat:@"%@\n%@", [msg.tags componentsJoinedByString:@", "],
- [msg.text stringByDecodingHTMLEntities]];
- }
+ [cell bind:msg];
+
cell.bodyLabel.preferredMaxLayoutWidth = tableView.bounds.size.width - (kLabelHorizontalInsets * 2.0f);
[cell setNeedsUpdateConstraints];