Skip to content

Commit 4ad6b8a

Browse files
committed
[Example] Update PostCell to use contentView
We need to place subviews onto UITableViewCell's contentView (to use `UITableViewCell.insetsContentViewsToSafeArea`).
1 parent 1619ad4 commit 4ad6b8a

File tree

2 files changed

+59
-50
lines changed

2 files changed

+59
-50
lines changed

Example/Example/Base.lproj/Storyboard.storyboard

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="SCa-L8-uTr">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="SCa-L8-uTr">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
99
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
1010
<capability name="Navigation items with more than one left or right bar item" minToolsVersion="7.0"/>
1111
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -40,7 +40,7 @@
4040
<navigationItem key="navigationItem" id="l1f-vB-6A8">
4141
<nil key="title"/>
4242
<segmentedControl key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="31B-gy-WIH">
43-
<rect key="frame" x="26" y="7" width="304" height="30"/>
43+
<rect key="frame" x="20" y="7" width="304" height="30"/>
4444
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
4545
<segments>
4646
<segment title="First"/>
@@ -460,6 +460,7 @@
460460
</tabBarItem>
461461
<toolbarItems/>
462462
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" translucent="NO" id="TRx-vY-PeE">
463+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
463464
<autoresizingMask key="autoresizingMask"/>
464465
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
465466
</navigationBar>
@@ -481,6 +482,7 @@
481482
</tabBarItem>
482483
<toolbarItems/>
483484
<navigationBar key="navigationBar" contentMode="scaleToFill" id="2I8-g6-D4S">
485+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
484486
<autoresizingMask key="autoresizingMask"/>
485487
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
486488
<textAttributes key="titleTextAttributes">
@@ -600,6 +602,7 @@
600602
</tabBarItem>
601603
<toolbarItems/>
602604
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" translucent="NO" id="iMm-hr-oOU">
605+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
603606
<autoresizingMask key="autoresizingMask"/>
604607
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
605608
</navigationBar>
@@ -621,6 +624,7 @@
621624
</tabBarItem>
622625
<toolbarItems/>
623626
<navigationBar key="navigationBar" contentMode="scaleToFill" id="PUj-LI-AQ6">
627+
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
624628
<autoresizingMask key="autoresizingMask"/>
625629
<color key="barTintColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
626630
<textAttributes key="titleTextAttributes">
Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,62 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
610
</dependencies>
711
<objects>
812
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
913
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10-
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="PostCell" customModule="Example" customModuleProvider="target">
11-
<rect key="frame" x="0.0" y="0.0" width="326" height="84"/>
12-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13-
<subviews>
14-
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3cF-Pb-bhF">
15-
<rect key="frame" x="12" y="12" width="60" height="60"/>
16-
<constraints>
17-
<constraint firstAttribute="width" constant="60" id="Pny-Yy-5g4"/>
18-
<constraint firstAttribute="height" constant="60" id="xre-y3-QCa"/>
19-
</constraints>
20-
</imageView>
21-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XpS-ev-AZK">
22-
<rect key="frame" x="80" y="12" width="229" height="18"/>
23-
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
24-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
25-
<nil key="highlightedColor"/>
26-
</label>
27-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M84-ZZ-G5B">
28-
<rect key="frame" x="80" y="38" width="229" height="18"/>
29-
<fontDescription key="fontDescription" type="system" pointSize="15"/>
30-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
31-
<nil key="highlightedColor"/>
32-
</label>
33-
</subviews>
34-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
35-
<constraints>
36-
<constraint firstAttribute="trailing" secondItem="M84-ZZ-G5B" secondAttribute="trailing" constant="17" id="ERc-X0-bm6"/>
37-
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="M84-ZZ-G5B" secondAttribute="bottom" priority="999" constant="20" id="I1d-nA-bLK"/>
38-
<constraint firstItem="XpS-ev-AZK" firstAttribute="leading" secondItem="3cF-Pb-bhF" secondAttribute="trailing" constant="8" id="MCp-qr-s7q"/>
39-
<constraint firstItem="M84-ZZ-G5B" firstAttribute="top" secondItem="XpS-ev-AZK" secondAttribute="bottom" constant="8" id="PxD-gM-hbj"/>
40-
<constraint firstItem="M84-ZZ-G5B" firstAttribute="leading" secondItem="3cF-Pb-bhF" secondAttribute="trailing" constant="8" id="VmA-J2-6Ur"/>
41-
<constraint firstItem="3cF-Pb-bhF" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="Vqu-xf-y9G"/>
42-
<constraint firstItem="XpS-ev-AZK" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="XP8-3C-YTa"/>
43-
<constraint firstAttribute="trailing" secondItem="XpS-ev-AZK" secondAttribute="trailing" constant="17" id="dh0-1d-SBr"/>
44-
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="3cF-Pb-bhF" secondAttribute="bottom" priority="999" constant="12" id="f9x-qu-WpO"/>
45-
<constraint firstItem="3cF-Pb-bhF" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="12" id="rjQ-uH-Euv"/>
46-
</constraints>
47-
<nil key="simulatedStatusBarMetrics"/>
48-
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
14+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="84" id="b8n-8Y-pxb" customClass="PostCell" customModule="Example" customModuleProvider="target">
15+
<rect key="frame" x="0.0" y="0.0" width="375" height="84"/>
16+
<autoresizingMask key="autoresizingMask"/>
17+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="b8n-8Y-pxb" id="K88-rd-6gZ">
18+
<rect key="frame" x="0.0" y="0.0" width="375" height="83.5"/>
19+
<autoresizingMask key="autoresizingMask"/>
20+
<subviews>
21+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="wQ5-jv-KcD">
22+
<rect key="frame" x="12" y="12" width="60" height="60"/>
23+
<constraints>
24+
<constraint firstAttribute="height" constant="60" id="a22-Yz-B14"/>
25+
<constraint firstAttribute="width" constant="60" id="h3B-3k-YAV"/>
26+
</constraints>
27+
</imageView>
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="Xt9-VS-IpY">
29+
<rect key="frame" x="80" y="12" width="278" height="18"/>
30+
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
31+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
32+
<nil key="highlightedColor"/>
33+
</label>
34+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fIC-u4-GzA">
35+
<rect key="frame" x="80" y="38" width="278" height="18"/>
36+
<fontDescription key="fontDescription" type="system" pointSize="15"/>
37+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
38+
<nil key="highlightedColor"/>
39+
</label>
40+
</subviews>
41+
<constraints>
42+
<constraint firstItem="wQ5-jv-KcD" firstAttribute="top" secondItem="K88-rd-6gZ" secondAttribute="top" constant="12" id="0nA-Ff-0jE"/>
43+
<constraint firstItem="Xt9-VS-IpY" firstAttribute="leading" secondItem="wQ5-jv-KcD" secondAttribute="trailing" constant="8" id="CJD-v3-ZI5"/>
44+
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="fIC-u4-GzA" secondAttribute="bottom" priority="999" constant="20" id="Dsa-9n-hAy"/>
45+
<constraint firstAttribute="trailing" secondItem="fIC-u4-GzA" secondAttribute="trailing" constant="17" id="NGB-u3-BwT"/>
46+
<constraint firstItem="Xt9-VS-IpY" firstAttribute="top" secondItem="K88-rd-6gZ" secondAttribute="top" constant="12" id="aeT-ml-Joy"/>
47+
<constraint firstItem="fIC-u4-GzA" firstAttribute="leading" secondItem="wQ5-jv-KcD" secondAttribute="trailing" constant="8" id="cdd-j8-SOs"/>
48+
<constraint firstItem="wQ5-jv-KcD" firstAttribute="leading" secondItem="K88-rd-6gZ" secondAttribute="leading" constant="12" id="hyC-j1-1ur"/>
49+
<constraint firstAttribute="bottom" secondItem="wQ5-jv-KcD" secondAttribute="bottom" priority="999" constant="12" id="igs-Iw-meI"/>
50+
<constraint firstAttribute="trailing" secondItem="Xt9-VS-IpY" secondAttribute="trailing" constant="17" id="xNw-iC-WEv"/>
51+
<constraint firstItem="fIC-u4-GzA" firstAttribute="top" secondItem="Xt9-VS-IpY" secondAttribute="bottom" constant="8" id="ypP-AG-hch"/>
52+
</constraints>
53+
</tableViewCellContentView>
4954
<connections>
50-
<outlet property="postName" destination="XpS-ev-AZK" id="sua-hr-KD7"/>
51-
<outlet property="postText" destination="M84-ZZ-G5B" id="981-BE-BOc"/>
52-
<outlet property="userImage" destination="3cF-Pb-bhF" id="rkH-iK-qN8"/>
55+
<outlet property="postName" destination="Xt9-VS-IpY" id="VYd-5D-WAS"/>
56+
<outlet property="postText" destination="fIC-u4-GzA" id="GvN-fW-jWH"/>
57+
<outlet property="userImage" destination="wQ5-jv-KcD" id="T64-Nd-dc9"/>
5358
</connections>
54-
<point key="canvasLocation" x="362" y="495"/>
55-
</view>
59+
<point key="canvasLocation" x="348" y="692"/>
60+
</tableViewCell>
5661
</objects>
5762
</document>

0 commit comments

Comments
 (0)