From 8af785b209412b5d52dcd0503ccdbab108c506a7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 5 Nov 2018 22:45:49 +0300 Subject: Bye-bye, TTTAttributedLabel --- Juick/Views/BubbleMessageCell.h | 5 ++--- Juick/Views/BubbleMessageCell.m | 12 ++---------- Juick/Views/BubbleMessageCell.xib | 18 +++++++++--------- Juick/Views/FixedLabel.h | 13 ------------- Juick/Views/FixedLabel.m | 21 --------------------- Juick/Views/MessageCell.h | 4 ++-- Juick/Views/MessageCell.m | 11 ++--------- Juick/Views/MessageCell.xib | 31 ++++++++++++++++--------------- 8 files changed, 33 insertions(+), 82 deletions(-) delete mode 100644 Juick/Views/FixedLabel.h delete mode 100644 Juick/Views/FixedLabel.m (limited to 'Juick/Views') diff --git a/Juick/Views/BubbleMessageCell.h b/Juick/Views/BubbleMessageCell.h index 933337b..bad2fc4 100644 --- a/Juick/Views/BubbleMessageCell.h +++ b/Juick/Views/BubbleMessageCell.h @@ -8,13 +8,12 @@ #import #import "Message.h" -#import "FixedLabel.h" -@interface BubbleMessageCell : UITableViewCell +@interface BubbleMessageCell : UITableViewCell @property (strong, nonatomic) IBOutlet UIImageView *avatarView; @property (strong, nonatomic) IBOutlet UILabel *unreadMarker; @property (strong, nonatomic) IBOutlet UILabel *name; -@property (strong, nonatomic) IBOutlet FixedLabel *message; +@property (strong, nonatomic) IBOutlet UITextView *message; -(void) configureWithMessage:(Message *) message isMe:(BOOL)isMe; diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m index 42b6019..87b482c 100644 --- a/Juick/Views/BubbleMessageCell.m +++ b/Juick/Views/BubbleMessageCell.m @@ -25,8 +25,8 @@ -(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe { self.message.backgroundColor = isMe ? [ColorScheme secondaryBackground] : [ColorScheme mainBackground]; self.message.textColor = isMe ? [UIColor whiteColor] : [ColorScheme textColor]; - self.message.linkAttributes = @{ (id)kCTForegroundColorAttributeName: isMe ? [UIColor whiteColor] : [ColorScheme linkColor], - (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; + self.message.dataDetectorTypes = UIDataDetectorTypeAll; + self.message.tintColor = isMe? [UIColor whiteColor] : [ColorScheme linkColor]; self.name.text = message.user.uname; self.message.text = message.text; self.unreadMarker.text = @""; @@ -40,14 +40,6 @@ } completion:nil]; } failure:nil]; - self.message.enabledTextCheckingTypes = NSTextCheckingTypeLink; - self.message.clipsToBounds = YES; - self.message.textInsets = UIEdgeInsetsMake(4.0f, 8.0f, 4.0f, 8.0f); -} - --(void) attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { - [[UIApplication sharedApplication] openURL:url options: - @{} completionHandler:nil]; } @end diff --git a/Juick/Views/BubbleMessageCell.xib b/Juick/Views/BubbleMessageCell.xib index 3f9670e..75afe92 100644 --- a/Juick/Views/BubbleMessageCell.xib +++ b/Juick/Views/BubbleMessageCell.xib @@ -43,21 +43,21 @@ - + - + + @@ -75,7 +75,7 @@ - + diff --git a/Juick/Views/FixedLabel.h b/Juick/Views/FixedLabel.h deleted file mode 100644 index f05ac94..0000000 --- a/Juick/Views/FixedLabel.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// FixedLabel.h -// Juick -// -// Created by Vitaly Takmazov on 04/03/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import - -@interface FixedLabel : TTTAttributedLabel - -@end diff --git a/Juick/Views/FixedLabel.m b/Juick/Views/FixedLabel.m deleted file mode 100644 index 24d8648..0000000 --- a/Juick/Views/FixedLabel.m +++ /dev/null @@ -1,21 +0,0 @@ -// -// FixedLabel.m -// Juick -// -// Created by Vitaly Takmazov on 04/03/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import "FixedLabel.h" - -@implementation FixedLabel - -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect { - // Drawing code -} -*/ - -@end diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index abb1347..846bf30 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -13,13 +13,13 @@ -(void) avatarClicked:(NSString *)uname; @end -@interface MessageCell : UITableViewCell +@interface MessageCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIImageView *avatar; @property (weak, nonatomic) IBOutlet UILabel *title; @property (weak, nonatomic) IBOutlet UILabel *timestamp; @property (weak, nonatomic) IBOutlet TagListView *tags; -@property (weak, nonatomic) IBOutlet TTTAttributedLabel *text; +@property (weak, nonatomic) IBOutlet UITextView *text; @property (weak, nonatomic) IBOutlet UIImageView *attach; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight; @property (weak, nonatomic) IBOutlet UILabel *summary; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index ffb564a..851e097 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -15,10 +15,8 @@ - (void)awakeFromNib { [super awakeFromNib]; self.text.textColor = [ColorScheme textColor]; - self.text.enabledTextCheckingTypes = NSTextCheckingTypeLink; - self.text.delegate = self; - self.text.linkAttributes = @{ (id)kCTForegroundColorAttributeName: [ColorScheme linkColor], - (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; + self.text.dataDetectorTypes = UIDataDetectorTypeAll; + self.text.tintColor = [ColorScheme linkColor]; self.title.textColor = [ColorScheme linkColor]; self.timestamp.textColor = [UIColor grayColor]; self.summary.textColor = [UIColor grayColor]; @@ -81,13 +79,8 @@ } } --(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { - [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; -} - -(void) avatarClicked:(UIGestureRecognizer *)gestureRecognizer { [self.delegate avatarClicked:self.title.text]; } - @end diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index c1f9e83..3b40cf6 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -22,18 +22,18 @@ - - + + - + - + - + - - + + @@ -80,21 +80,22 @@ - + + - +