summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2013-11-03 01:36:13 +0400
committerGravatar Vitaly Takmazov2013-11-03 01:36:13 +0400
commite539bdfe4c81fb56fc1974596f1795e061b52663 (patch)
tree2cd709e69ec8ad9c52fb0c63f3a6a398d10f1cdb
parent566f122683240ea47f391033ec4e11ef424e7a5c (diff)
Detect links
-rw-r--r--Juick/MasterViewController.m2
-rw-r--r--Juick/MessageCell.h7
-rw-r--r--Juick/MessageCell.m10
-rw-r--r--Podfile1
-rw-r--r--Podfile.lock6
5 files changed, 16 insertions, 10 deletions
diff --git a/Juick/MasterViewController.m b/Juick/MasterViewController.m
index bd75f82..74b4fdc 100644
--- a/Juick/MasterViewController.m
+++ b/Juick/MasterViewController.m
@@ -6,8 +6,6 @@
// Copyright (c) 2013 com.juick. All rights reserved.
//
-#import "SWRevealViewController.h"
-
#import "MasterViewController.h"
#import "MessageCell.h"
diff --git a/Juick/MessageCell.h b/Juick/MessageCell.h
index 6f93048..299c3b3 100644
--- a/Juick/MessageCell.h
+++ b/Juick/MessageCell.h
@@ -7,14 +7,15 @@
//
#import <UIKit/UIKit.h>
+#import "TTTAttributedLabel.h"
#define kLabelHorizontalInsets 20.0f
-@interface MessageCell : UITableViewCell
+@interface MessageCell : UITableViewCell<TTTAttributedLabelDelegate>
-@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
-@property (strong, nonatomic) IBOutlet UILabel *bodyLabel;
+@property (strong, nonatomic) IBOutlet TTTAttributedLabel *titleLabel;
+@property (strong, nonatomic) IBOutlet TTTAttributedLabel *bodyLabel;
- (void)updateFonts;
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
diff --git a/Podfile b/Podfile
index d67c54c..ff63ed9 100644
--- a/Podfile
+++ b/Podfile
@@ -3,6 +3,7 @@ platform :ios, "6.0"
target "Juick" do
pod 'MWFeedParser'
+pod 'TTTAttributedLabel'
end
target "JuickTests" do
diff --git a/Podfile.lock b/Podfile.lock
index 5a89ae6..873fcba 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -8,14 +8,14 @@ PODS:
- MWFeedParser/NSDate+InternetDateTime (0.0.1)
- MWFeedParser/NSString+HTML (0.0.1)
- MWFeedParser/NSString+XMLEntities (0.0.1)
- - PKRevealController (2.0.5)
+ - TTTAttributedLabel (1.7.1)
DEPENDENCIES:
- MWFeedParser
- - PKRevealController
+ - TTTAttributedLabel
SPEC CHECKSUMS:
MWFeedParser: 2ca0852fac352f8333d5f46fdd4b583b921e0c4e
- PKRevealController: 50a737bde432e51b68596d46b33617ec8bcb3a6a
+ TTTAttributedLabel: e504133915a9b11de63cb470ffa2790383a3eb23
COCOAPODS: 0.27.1