diff options
author | Vitaly Takmazov | 2018-11-05 22:45:49 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-11-05 22:45:49 +0300 |
commit | 8af785b209412b5d52dcd0503ccdbab108c506a7 (patch) | |
tree | 265cdf02b408f65dd2398ffbd321bd68e256b67d /Juick | |
parent | 3fb9ed7994aa50b1281ec6be1ff4727842d3d0c2 (diff) |
Bye-bye, TTTAttributedLabel
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/Supporting Files/Juick-Prefix.pch | 1 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.h | 5 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.m | 12 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.xib | 18 | ||||
-rw-r--r-- | Juick/Views/FixedLabel.h | 13 | ||||
-rw-r--r-- | Juick/Views/FixedLabel.m | 21 | ||||
-rw-r--r-- | Juick/Views/MessageCell.h | 4 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 11 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 31 |
9 files changed, 33 insertions, 83 deletions
diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index 2123166..2f4b637 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -20,7 +20,6 @@ #import <PDKeychainBindingsController/PDKeychainBindingsController.h> #import <NSString+HTML.h> #import "UIImage+Utils.h" - #import <TTTAttributedLabel/TTTAttributedLabel.h> #import <AFNetworking/AFNetworking.h> #import <AFNetworking/UIImageView+AFNetworking.h> #import <YYModel/YYModel.h> 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 <UIKit/UIKit.h> #import "Message.h" -#import "FixedLabel.h" -@interface BubbleMessageCell : UITableViewCell<TTTAttributedLabelDelegate> +@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 @@ </constraints> </stackView> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="xm7-By-6oe"> - <rect key="frame" x="54" y="10.5" width="311" height="158.5"/> + <rect key="frame" x="54" y="0.0" width="311" height="179.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="ermine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UEj-yl-U0d"> - <rect key="frame" x="0.0" y="0.0" width="311" height="16"/> + <rect key="frame" x="0.0" y="0.0" width="311" height="0.0"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yf3-FC-T1Y" customClass="FixedLabel"> - <rect key="frame" x="0.0" y="28" width="311" height="130.5"/> - <string key="text">Lorem sdsdasds sdsada ddas dsad asdsadas dasd asdsa sadsa dasdsad asd asdas dasd asdas dasd asdas dasdasdasd asdasdasdadasdasd asdasd asdas dasdsa dasdasdasdasdas dasdas</string> + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PUY-2b-P8y"> + <rect key="frame" x="0.0" y="12" width="311" height="167.5"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> - <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> - <nil key="highlightedColor"/> - </label> + <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> + </textView> </subviews> </stackView> </subviews> @@ -75,7 +75,7 @@ <gestureRecognizers/> <connections> <outlet property="avatarView" destination="ho8-hh-u3y" id="XnI-4Y-f3I"/> - <outlet property="message" destination="yf3-FC-T1Y" id="Iwg-L7-jm6"/> + <outlet property="message" destination="PUY-2b-P8y" id="4gD-7L-TLd"/> <outlet property="name" destination="UEj-yl-U0d" id="unG-q9-Kwv"/> <outlet property="unreadMarker" destination="5rl-Qo-5oW" id="an8-JJ-Gbb"/> </connections> 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 <TTTAttributedLabel/TTTAttributedLabel.h> - -@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<TTTAttributedLabelDelegate> +@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 @@ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="Azj-pa-GEC"> <rect key="frame" x="6" y="6" width="562" height="425.5"/> <subviews> - <stackView opaque="NO" contentMode="scaleToFill" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> - <rect key="frame" x="0.0" y="0.0" width="562" height="50"/> + <stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> + <rect key="frame" x="0.0" y="0.0" width="562" height="48"/> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS"> - <rect key="frame" x="0.0" y="0.0" width="50" height="50"/> + <rect key="frame" x="0.0" y="0.0" width="50" height="48"/> <constraints> - <constraint firstAttribute="height" priority="750" constant="48" id="ZnT-UD-xga"/> + <constraint firstAttribute="height" priority="999" constant="48" id="ZnT-UD-xga"/> <constraint firstAttribute="width" priority="750" constant="48" id="khZ-DB-qfq"/> </constraints> </imageView> <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF"> - <rect key="frame" x="62" y="4" width="500" height="42.5"/> + <rect key="frame" x="62" y="3" width="500" height="42.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHd-h0-hPk"> <rect key="frame" x="0.0" y="0.0" width="500" height="20.5"/> @@ -51,8 +51,8 @@ </stackView> </subviews> </stackView> - <view contentMode="scaleToFill" verticalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="N08-my-2Lr" customClass="TagListView"> - <rect key="frame" x="0.0" y="62" width="562" height="35"/> + <view contentMode="scaleToFill" verticalCompressionResistancePriority="749" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N08-my-2Lr" customClass="TagListView"> + <rect key="frame" x="0.0" y="60" width="562" height="0.0"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="borderWidth"> <real key="value" value="1"/> @@ -80,21 +80,22 @@ </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zZm-hh-bDO" customClass="TTTAttributedLabel"> - <rect key="frame" x="0.0" y="109" width="562" height="20.5"/> + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" ambiguous="YES" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt"> + <rect key="frame" x="0.0" y="72" width="562" height="71.5"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> + <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> + </textView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Uha-ow-kFJ"> - <rect key="frame" x="0.0" y="141.5" width="562" height="256"/> + <rect key="frame" x="0.0" y="155.5" width="562" height="256"/> <constraints> <constraint firstAttribute="height" priority="999" constant="256" identifier="attachHeight" id="Cuq-dQ-VYU"/> <constraint firstAttribute="width" priority="999" constant="256" id="oJg-1R-jp3"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aJE-mZ-MCS"> - <rect key="frame" x="0.0" y="409.5" width="562" height="16"/> + <rect key="frame" x="0.0" y="423.5" width="562" height="2"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -116,7 +117,7 @@ <outlet property="avatar" destination="CZk-Q8-JqS" id="0Jh-5F-W9D"/> <outlet property="summary" destination="aJE-mZ-MCS" id="lWR-A2-40d"/> <outlet property="tags" destination="N08-my-2Lr" id="MwG-ij-n7e"/> - <outlet property="text" destination="zZm-hh-bDO" id="mqX-Cm-d4L"/> + <outlet property="text" destination="nZn-a4-oSt" id="Bee-gX-BGk"/> <outlet property="timestamp" destination="AVu-qV-q84" id="Cyn-0y-V0R"/> <outlet property="title" destination="CHd-h0-hPk" id="BuC-dv-0sU"/> </connections> |