summaryrefslogtreecommitdiff
path: root/Juick/MessageCell.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2014-02-01 20:17:24 +0400
committerGravatar Vitaly Takmazov2014-02-01 20:17:24 +0400
commit50a0ecf985bbe81aacfac85192652c2495b769f6 (patch)
tree7edef997c75b5c3de28834782efbc671f026a855 /Juick/MessageCell.m
parent6ee0e66d56f02c4b534dd83fca24cb0c1f408f06 (diff)
move UILabel sizeForLabel to category
Diffstat (limited to 'Juick/MessageCell.m')
-rw-r--r--Juick/MessageCell.m11
1 files changed, 4 insertions, 7 deletions
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m
index 8c2f001..d2b2983 100644
--- a/Juick/MessageCell.m
+++ b/Juick/MessageCell.m
@@ -80,31 +80,28 @@
// Configure the view for the selected state
}
-- (CGRect) sizeForLabel:(UILabel *)label width:(CGFloat)width {
- return [label.text boundingRectWithSize:(CGSize) {width, CGFLOAT_MAX} options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:label.font} context:nil];
-}
- (CGRect) avatarRect {
return CGRectMake(kPaddingX, kPaddingY, kAvatarSizeX, kAvatarSizeY);
}
- (CGRect) bodyRect {
- CGRect bodySize = [self sizeForLabel:self.bodyLabel width:(self.contentView.bounds.size.width - kPaddingX * 2)];
+ CGRect bodySize = [UILabel sizeForLabel:self.bodyLabel width:(self.contentView.bounds.size.width - kPaddingX * 2)];
return CGRectMake(kPaddingX, kPaddingY + kAvatarSizeY + kPaddingY * 2, bodySize.size.width, bodySize.size.height);
}
- (CGRect) titleRect {
- CGRect titleSize = [self sizeForLabel:self.titleLabel width:self.contentView.bounds.size.width - [self avatarRect].size.width - kPaddingX * 2];
+ CGRect titleSize = [UILabel sizeForLabel:self.titleLabel width:self.contentView.bounds.size.width - [self avatarRect].size.width - kPaddingX * 2];
return CGRectMake(kPaddingX + kAvatarSizeX + kPaddingX, kPaddingY, titleSize.size.width, titleSize.size.height);
}
- (CGRect) timestampRect {
- CGRect timeStampSize = [self sizeForLabel:self.timestampLabel width:self.contentView.bounds.size.width - [self avatarRect].size.width - kPaddingX * 2];
+ CGRect timeStampSize = [UILabel sizeForLabel:self.timestampLabel width:self.contentView.bounds.size.width - [self avatarRect].size.width - kPaddingX * 2];
return CGRectMake(kPaddingX + [self avatarRect].size.width + kPaddingX, kPaddingY + [self titleRect].size.height + kPaddingY, timeStampSize.size.width, timeStampSize.size.height);
}
- (CGRect) summaryRect {
- CGRect summarySize = [self sizeForLabel:self.summaryLabel width:(self.contentView.bounds.size.width - 20)];
+ CGRect summarySize = [UILabel sizeForLabel:self.summaryLabel width:(self.contentView.bounds.size.width - 20)];
float summaryY = 10 + 32 + 10 + [self bodyRect].size.height + 10;
if (self.message.attach != nil) {
summaryY += [self attachRect].size.height + 10;