diff options
Diffstat (limited to 'Juick/MessageCell.m')
-rw-r--r-- | Juick/MessageCell.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m index a8b2522..dc698b3 100644 --- a/Juick/MessageCell.m +++ b/Juick/MessageCell.m @@ -20,7 +20,7 @@ { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { - self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.titleLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero]; [self.titleLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; [self.titleLabel setLineBreakMode:NSLineBreakByTruncatingTail]; [self.titleLabel setNumberOfLines:1]; @@ -28,7 +28,9 @@ [self.titleLabel setTextColor:[UIColor blackColor]]; [self.titleLabel setBackgroundColor:[UIColor clearColor]]; - self.bodyLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.bodyLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero]; + self.bodyLabel.dataDetectorTypes = NSTextCheckingTypeLink; + self.bodyLabel.delegate = self; [self.bodyLabel setTranslatesAutoresizingMaskIntoConstraints:NO]; [self.bodyLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; [self.bodyLabel setLineBreakMode:NSLineBreakByTruncatingTail]; @@ -131,4 +133,8 @@ self.bodyLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; } +- (void) attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { + [[UIApplication sharedApplication] openURL:url]; +} + @end |