summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-01 23:05:16 +0300
committerGravatar Vitaly Takmazov2019-10-01 23:05:16 +0300
commit68befabf1b72dc03acdacc4e443b00f80495b7fe (patch)
tree76781daa9b853854d1d180a75608bf1fc77ba4f5
parentfbbe573afe150a23205264d0d46b4e00d7330b8a (diff)
MessageCell styling
-rw-r--r--Juick/Views/MessageCell.h1
-rw-r--r--Juick/Views/MessageCell.m12
-rw-r--r--Juick/Views/MessageCell.xib27
3 files changed, 23 insertions, 17 deletions
diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h
index 7648c52..684a620 100644
--- a/Juick/Views/MessageCell.h
+++ b/Juick/Views/MessageCell.h
@@ -21,6 +21,7 @@
@property (weak, nonatomic) IBOutlet UITextView *text;
@property (weak, nonatomic) IBOutlet UIImageView *attach;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight;
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentWidth;
@property (weak, nonatomic) IBOutlet UILabel *summary;
@property (nonatomic, strong) id<MessageCellDelegate> delegate;
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m
index 551a54d..4d53273 100644
--- a/Juick/Views/MessageCell.m
+++ b/Juick/Views/MessageCell.m
@@ -57,11 +57,14 @@
completion:nil];
}];
if ([msg.attach length] > 0) {
- self.attach.image = [UIImage placeholderImageWithColor:[UIColor colorNamed:@"Muted"] size:CGSizeMake([msg.attachment.medium.width floatValue], [msg.attachment.medium.height floatValue])];
- CGFloat imageHeight = [msg.attachment.medium.height floatValue] / [[UIScreen mainScreen] scale];
+ CGFloat imageHeight = [msg.attachment.small.height floatValue] / [[UIScreen mainScreen] scale];
+ CGFloat imageWidth = [msg.attachment.small.width floatValue] / [[UIScreen mainScreen] scale];
+ self.attach.image = [UIImage placeholderImageWithColor:[UIColor colorNamed:@"Muted"] size:CGSizeMake(imageWidth, imageHeight)];
+
self.attachmentHeight.constant = imageHeight;
+ self.attachmentWidth.constant = imageWidth;
__weak UIImageView *weakAttach = self.attach;
- [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.attachment.medium.url] callback:^(NSData *data) {
+ [[APIClient sharedClient] fetchImageWithURL:[NSURL URLWithString:msg.attachment.small.url] callback:^(NSData *data) {
[UIView transitionWithView:weakAttach
duration:0.3
options:UIViewAnimationOptionTransitionCrossDissolve
@@ -89,6 +92,7 @@
}
self.text.attributedText = nil;
if (msg.text) {
+ [self.text setHidden:NO];
NSMutableAttributedString *txt = [[NSMutableAttributedString alloc]
initWithString:msg.text
attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]}];
@@ -133,6 +137,8 @@
}
[txt endEditing];
self.text.attributedText = txt;
+ } else {
+ [self.text setHidden:YES];
}
}
diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib
index f4ae806..5b5ebd3 100644
--- a/Juick/Views/MessageCell.xib
+++ b/Juick/Views/MessageCell.xib
@@ -1,29 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+ <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
- <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="604" id="KGk-i7-Jjw" customClass="MessageCell">
+ <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="604" id="KGk-i7-Jjw" customClass="MessageCell">
<rect key="frame" x="0.0" y="0.0" width="572" height="604"/>
<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="572" height="603.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="572" height="604"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="Azj-pa-GEC">
- <rect key="frame" x="6" y="6" width="560" height="591.5"/>
+ <rect key="frame" x="6" y="6" width="560" height="592"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d">
- <rect key="frame" x="0.0" y="0.0" width="560" height="91.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="560" height="92"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS">
<rect key="frame" x="0.0" y="22" width="48" height="48"/>
@@ -33,7 +31,7 @@
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF">
- <rect key="frame" x="60" y="24.5" width="500" height="42.5"/>
+ <rect key="frame" x="60" y="25" 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"/>
@@ -52,21 +50,21 @@
</subviews>
</stackView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="749" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt">
- <rect key="frame" x="0.0" y="103.5" width="560" height="192"/>
+ <rect key="frame" x="0.0" y="104" width="560" height="192"/>
<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"/>
<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="307.5" width="560" height="256"/>
+ <rect key="frame" x="0.0" y="308" width="560" 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"/>
+ <constraint firstAttribute="width" priority="999" constant="256" identifier="attachWidth" 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="575.5" width="560" height="16"/>
+ <rect key="frame" x="0.0" y="576" width="560" height="16"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@@ -85,6 +83,7 @@
<connections>
<outlet property="attach" destination="Uha-ow-kFJ" id="s6u-WS-Ybt"/>
<outlet property="attachmentHeight" destination="Cuq-dQ-VYU" id="5DR-sP-vQI"/>
+ <outlet property="attachmentWidth" destination="oJg-1R-jp3" id="ImJ-1g-7NW"/>
<outlet property="avatar" destination="CZk-Q8-JqS" id="0Jh-5F-W9D"/>
<outlet property="summary" destination="aJE-mZ-MCS" id="lWR-A2-40d"/>
<outlet property="text" destination="nZn-a4-oSt" id="Bee-gX-BGk"/>