diff options
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/Views/MessageCell.h | 4 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 7 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 41 |
3 files changed, 24 insertions, 28 deletions
diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index c40a12c..394757b 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -9,12 +9,12 @@ #import <UIKit/UIKit.h> #import "Message.h" -@interface MessageCell : UITableViewCell +@interface MessageCell : UITableViewCell<TTTAttributedLabelDelegate> @property (weak, nonatomic) IBOutlet UILabel *title; @property (weak, nonatomic) IBOutlet UILabel *timestamp; @property (weak, nonatomic) IBOutlet UIImageView *avatar; -@property (weak, nonatomic) IBOutlet UILabel *text; +@property (weak, nonatomic) IBOutlet TTTAttributedLabel *text; @property (weak, nonatomic) IBOutlet UIImageView *attach; @property (weak, nonatomic) IBOutlet UILabel *summary; @property (strong, nonatomic) Message * message; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 1ffc1c9..963707c 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -12,7 +12,8 @@ - (void)awakeFromNib { [super awakeFromNib]; - // Initialization code + self.text.enabledTextCheckingTypes = NSTextCheckingTypeLink; + self.text.delegate = self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { @@ -46,4 +47,8 @@ } } +-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { + [[UIApplication sharedApplication] openURL:url]; +} + @end diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index 25a35b5..40eae49 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> @@ -11,54 +12,44 @@ <rect key="frame" x="0.0" y="0.0" width="592" height="343"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> - <rect key="frame" x="0.0" y="0.0" width="592" height="342.5"/> + <frame key="frameInset" width="592" height="342.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="rE3-Mc-Kov"> - <rect key="frame" x="12" y="12" width="568" height="319"/> <subviews> - <stackView opaque="NO" contentMode="scaleToFill" misplaced="YES" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="lkI-Na-bF2"> - <rect key="frame" x="0.0" y="0.0" width="102" height="48"/> + <stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="lkI-Na-bF2"> <subviews> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kHx-jc-jaD"> - <rect key="frame" x="0.0" y="0.0" width="48" height="48"/> <constraints> <constraint firstAttribute="width" constant="48" id="LYl-qV-pOl"/> <constraint firstAttribute="height" constant="48" id="ebd-hi-9gJ"/> </constraints> </imageView> - <stackView opaque="NO" contentMode="scaleToFill" misplaced="YES" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="ttr-pF-8Zm"> - <rect key="frame" x="60" y="0.0" width="42" height="48"/> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="ttr-pF-8Zm"> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zVa-uf-1Mb"> - <rect key="frame" x="0.0" y="0.0" width="42" height="28"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zVa-uf-1Mb"> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> - <color key="textColor" red="0.0" green="0.40000000000000002" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/> + <color key="textColor" red="0.0" green="0.40000000000000002" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="252" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5IY-8Y-0W9"> - <rect key="frame" x="0.0" y="34" width="42" height="15"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="252" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5IY-8Y-0W9"> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> - <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/> + <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> </subviews> </stackView> </subviews> </stackView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Q9-qY-nj2"> - <rect key="frame" x="0.0" y="54" width="40" height="189"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Q9-qY-nj2" customClass="TTTAttributedLabel"> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> - <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> + <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="53j-SC-IXj"> - <rect key="frame" x="0.0" y="249" width="50" height="50"/> - </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zDd-8E-ic8"> - <rect key="frame" x="0.0" y="305" width="31" height="15"/> + <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="53j-SC-IXj"/> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zDd-8E-ic8"> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> - <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/> + <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> </subviews> @@ -75,7 +66,7 @@ <outlet property="attach" destination="53j-SC-IXj" id="KJm-CX-dUB"/> <outlet property="avatar" destination="kHx-jc-jaD" id="Fta-hP-KqC"/> <outlet property="summary" destination="zDd-8E-ic8" id="8LF-Oz-1Co"/> - <outlet property="text" destination="0Q9-qY-nj2" id="9Qo-wq-TKX"/> + <outlet property="text" destination="0Q9-qY-nj2" id="M0J-BE-oUq"/> <outlet property="timestamp" destination="5IY-8Y-0W9" id="HBP-8W-F1a"/> <outlet property="title" destination="zVa-uf-1Mb" id="uOQ-uv-r33"/> </connections> |