Move StatusTableViewCell to separate nib

This commit is contained in:
Shadowfacts 2018-08-27 16:32:59 -04:00
parent 02fcea8675
commit b655c20e3d
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 82 additions and 63 deletions

View File

@ -14,6 +14,7 @@
D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; }; D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; };
D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */; }; D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */; };
D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; }; D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; };
D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D667E5E02134937B0057A976 /* StatusTableViewCell.xib */; };
D6BED16F212663DA00F02DA0 /* SwiftSoup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; }; D6BED16F212663DA00F02DA0 /* SwiftSoup.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; };
D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */; }; D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */; };
@ -70,6 +71,7 @@
D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = "<group>"; }; D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = "<group>"; };
D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Onboarding.storyboard; sourceTree = "<group>"; }; D64D0AAE2128D954005A6F37 /* Onboarding.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Onboarding.storyboard; sourceTree = "<group>"; };
D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; }; D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; };
D667E5E02134937B0057A976 /* StatusTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatusTableViewCell.xib; sourceTree = "<group>"; };
D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = "<group>"; }; D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = "<group>"; };
D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; }; D6D4DDCC212518A000E1C4BB /* Tusker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Tusker.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -122,6 +124,7 @@
children = ( children = (
D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */, D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */,
D64A0CD22132153900640E3B /* StatusContentLabel.swift */, D64A0CD22132153900640E3B /* StatusContentLabel.swift */,
D667E5E02134937B0057A976 /* StatusTableViewCell.xib */,
); );
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
@ -322,6 +325,7 @@
D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */, D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */,
D6F953EE21251A0700CF0F2B /* Timeline.storyboard in Resources */, D6F953EE21251A0700CF0F2B /* Timeline.storyboard in Resources */,
D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */, D6D4DDD5212518A000E1C4BB /* Main.storyboard in Resources */,
D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -16,62 +16,6 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="statusCell" rowHeight="72" id="n0V-Nu-zEt" customClass="StatusTableViewCell" customModule="Tusker" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="375" height="72"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="n0V-Nu-zEt" id="JcO-MN-o4M">
<rect key="frame" x="0.0" y="0.0" width="375" height="71.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZFA-wR-9b4">
<rect key="frame" x="76" y="11" width="103" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ffn-MC-jPW">
<rect key="frame" x="187" y="11" width="172" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" text="Content" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xX6-Gq-MFH" customClass="StatusContentLabel" customModule="Tusker" customModuleProvider="target">
<rect key="frame" x="76" y="40" width="283" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="7mj-Ts-blf">
<rect key="frame" x="16" y="11" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" secondItem="7mj-Ts-blf" secondAttribute="height" multiplier="1:1" id="9EB-YI-W3F"/>
<constraint firstAttribute="width" constant="50" id="Zon-62-0O6"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="trailing" secondItem="JcO-MN-o4M" secondAttribute="trailingMargin" id="3uJ-2V-odU"/>
<constraint firstItem="Ffn-MC-jPW" firstAttribute="leading" secondItem="ZFA-wR-9b4" secondAttribute="trailing" constant="8" id="Az0-iw-JrZ"/>
<constraint firstItem="Ffn-MC-jPW" firstAttribute="top" secondItem="JcO-MN-o4M" secondAttribute="topMargin" id="I7N-O4-Q6U"/>
<constraint firstItem="ZFA-wR-9b4" firstAttribute="leading" secondItem="7mj-Ts-blf" secondAttribute="trailing" constant="10" id="QJG-4Q-OfA"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="bottom" secondItem="JcO-MN-o4M" secondAttribute="bottomMargin" id="Td8-7G-sJ7"/>
<constraint firstItem="ZFA-wR-9b4" firstAttribute="top" secondItem="JcO-MN-o4M" secondAttribute="topMargin" id="a0F-RV-jI0"/>
<constraint firstAttribute="trailingMargin" secondItem="Ffn-MC-jPW" secondAttribute="trailing" id="eNm-X8-RAi"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="leading" secondItem="7mj-Ts-blf" secondAttribute="trailing" constant="10" id="f2g-6V-rMH"/>
<constraint firstItem="7mj-Ts-blf" firstAttribute="top" secondItem="JcO-MN-o4M" secondAttribute="topMargin" id="qBF-aB-ko3"/>
<constraint firstItem="7mj-Ts-blf" firstAttribute="leading" secondItem="JcO-MN-o4M" secondAttribute="leadingMargin" id="tna-7N-d7r"/>
<constraint firstItem="xX6-Gq-MFH" firstAttribute="top" secondItem="ZFA-wR-9b4" secondAttribute="bottom" constant="8" id="ufm-zI-r2q"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="avatarImageView" destination="7mj-Ts-blf" id="t77-xO-FIM"/>
<outlet property="contentLabel" destination="xX6-Gq-MFH" id="d7X-0B-daj"/>
<outlet property="displayNameLabel" destination="ZFA-wR-9b4" id="4Bg-aE-tVd"/>
<outlet property="usernameLabel" destination="Ffn-MC-jPW" id="dfo-KY-c7S"/>
</connections>
</tableViewCell>
</prototypes>
<connections> <connections>
<outlet property="dataSource" destination="6nb-nb-cMm" id="hf2-Hf-fX8"/> <outlet property="dataSource" destination="6nb-nb-cMm" id="hf2-Hf-fX8"/>
<outlet property="delegate" destination="6nb-nb-cMm" id="Dio-U3-a5Z"/> <outlet property="delegate" destination="6nb-nb-cMm" id="Dio-U3-a5Z"/>

View File

@ -42,6 +42,15 @@ class TimelineTableViewController: UITableViewController {
var newer: RequestRange? var newer: RequestRange?
var older: RequestRange? var older: RequestRange?
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 140
tableView.register(UINib(nibName: "StatusTableViewCell", bundle: nil), forCellReuseIdentifier: "statusCell")
}
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
guard MastodonController.shared.client?.accessToken != nil else { return } guard MastodonController.shared.client?.accessToken != nil else { return }
MastodonController.shared.client.run(timeline.request()) { result in MastodonController.shared.client.run(timeline.request()) { result in
@ -55,13 +64,6 @@ class TimelineTableViewController: UITableViewController {
} }
} }
override func viewDidLoad() {
super.viewDidLoad()
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 140
}
/* /*
// MARK: - Navigation // MARK: - Navigation

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/>
<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"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="StatusTableViewCell" customModule="Tusker" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="72"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QMP-j2-HLn">
<rect key="frame" x="16" y="8" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="KZ8-d7-8UK"/>
<constraint firstAttribute="height" constant="50" id="nMi-Gq-JyV"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gll-xe-FSr">
<rect key="frame" x="74" y="8" width="103" height="27.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j89-zc-SFa">
<rect key="frame" x="185" y="8" width="174" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Content" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HrJ-t9-KcD" customClass="StatusContentLabel" customModule="Tusker" customModuleProvider="target">
<rect key="frame" x="74" y="43.5" width="285" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="j89-zc-SFa" secondAttribute="trailing" constant="16" id="5yC-Iu-9HP"/>
<constraint firstItem="gll-xe-FSr" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="FWJ-6v-vIy"/>
<constraint firstItem="QMP-j2-HLn" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="16" id="GkY-18-OGG"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="HrJ-t9-KcD" secondAttribute="trailing" constant="16" id="IYh-GR-ULO"/>
<constraint firstItem="HrJ-t9-KcD" firstAttribute="top" secondItem="gll-xe-FSr" secondAttribute="bottom" constant="8" id="JQk-lY-oMh"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="HrJ-t9-KcD" secondAttribute="bottom" constant="8" id="LN7-OE-MeR"/>
<constraint firstItem="QMP-j2-HLn" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="8" id="LWg-Dg-s3z"/>
<constraint firstItem="gll-xe-FSr" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="8" id="N23-pL-q4r"/>
<constraint firstItem="j89-zc-SFa" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="8" id="V6L-v6-bJG"/>
<constraint firstItem="j89-zc-SFa" firstAttribute="leading" secondItem="gll-xe-FSr" secondAttribute="trailing" constant="8" id="aK9-17-4Zu"/>
<constraint firstItem="HrJ-t9-KcD" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="az1-qx-ih3"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<connections>
<outlet property="avatarImageView" destination="QMP-j2-HLn" id="CAl-hK-i3j"/>
<outlet property="contentLabel" destination="HrJ-t9-KcD" id="tbD-3T-nNP"/>
<outlet property="displayNameLabel" destination="gll-xe-FSr" id="63y-He-xy1"/>
<outlet property="usernameLabel" destination="j89-zc-SFa" id="see-Xd-3e9"/>
</connections>
<point key="canvasLocation" x="40.799999999999997" y="27.436281859070466"/>
</view>
</objects>
</document>