layout of BadgeViews in cell

This commit is contained in:
nixzhu
2015-07-02 16:05:31 +08:00
parent 4ae24355f1
commit eaebc2c101
2 changed files with 187 additions and 2 deletions
+176 -2
View File
@@ -4,6 +4,7 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
<!--Conversations-->
@@ -77,7 +78,7 @@
<outlet property="delegate" destination="la3-6z-2aH" id="zOV-zM-2KH"/>
</connections>
</collectionView>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Gu7-gn-2ia">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Gu7-gn-2ia">
<rect key="frame" x="0.0" y="270" width="600" height="100"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Swipe Up to Cancel" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zew-F7-znc">
@@ -106,7 +107,7 @@
<constraint firstItem="Zew-F7-znc" firstAttribute="top" secondItem="4p2-ZI-7q3" secondAttribute="bottom" constant="10" id="b9o-gU-cOq"/>
</constraints>
</view>
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q0w-sM-iIR" customClass="MessageToolbar" customModule="Yep" customModuleProvider="target">
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q0w-sM-iIR" customClass="MessageToolbar" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="0.0" y="390" width="600" height="50"/>
<animations/>
<items/>
@@ -1061,7 +1062,176 @@
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rCs-Rg-jvK" id="Q18-jR-H2H">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Iz2-o9-17H" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="115" y="48" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="FnR-av-JRq"/>
<constraint firstAttribute="width" constant="50" id="oxn-2a-F76"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mgs-nU-6GD" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="195" y="48" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Oet-yJ-Jb8"/>
<constraint firstAttribute="width" constant="50" id="ciO-dF-UqB"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AtA-Ag-AzS" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="355" y="48" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="MfJ-cZ-Cim"/>
<constraint firstAttribute="height" constant="50" id="vJS-sa-3o3"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zpA-BY-1sO" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="435" y="48" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="GWn-RC-Ubu"/>
<constraint firstAttribute="width" constant="50" id="cEY-79-Od7"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SjH-ms-KaO" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="115" y="118" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="D7R-NN-m6r"/>
<constraint firstAttribute="height" constant="50" id="TV7-0q-F6Q"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hU0-li-PMo" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="195" y="118" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="MYJ-Ll-Ifo"/>
<constraint firstAttribute="width" constant="50" id="w3v-NQ-MIi"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6V5-ZD-ySN" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="275" y="118" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="WhU-Sh-Us1"/>
<constraint firstAttribute="width" constant="50" id="sGV-Jg-UhD"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ys0-N9-ZWV" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="355" y="118" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="8Yt-VY-BXY"/>
<constraint firstAttribute="width" constant="50" id="oQU-J6-roJ"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Y9P-e7-eZ5" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="435" y="118" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="2FP-CS-XWR"/>
<constraint firstAttribute="height" constant="50" id="ZVZ-9X-89T"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="05f-r8-WNL" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="115" y="188" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Urm-wJ-CJH"/>
<constraint firstAttribute="width" constant="50" id="e5J-eC-p0F"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cXW-bq-1DS" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="195" y="188" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="icA-hh-X6c"/>
<constraint firstAttribute="width" constant="50" id="s1H-6S-jvp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xdf-d7-hOE" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="275" y="188" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="D3g-Ka-0yn"/>
<constraint firstAttribute="height" constant="50" id="aqu-56-fOp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="86U-zL-BF2" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="355" y="188" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="PD9-iF-HCF"/>
<constraint firstAttribute="width" constant="50" id="Qom-LV-lki"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xQ4-Pw-gO4" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="435" y="188" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="xR7-ue-dMM"/>
<constraint firstAttribute="width" constant="50" id="xSR-GH-BOD"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0U9-LP-d6j" customClass="BadgeView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="275" y="48" width="50" height="50"/>
<animations/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="5vQ-px-m0V"/>
<constraint firstAttribute="width" constant="50" id="D2F-ef-ueg"/>
</constraints>
</view>
</subviews>
<animations/>
<constraints>
<constraint firstItem="zpA-BY-1sO" firstAttribute="leading" secondItem="AtA-Ag-AzS" secondAttribute="trailing" constant="30" id="1lV-M6-3XH"/>
<constraint firstItem="6V5-ZD-ySN" firstAttribute="centerX" secondItem="0U9-LP-d6j" secondAttribute="centerX" id="48p-UL-twb"/>
<constraint firstItem="AtA-Ag-AzS" firstAttribute="centerY" secondItem="0U9-LP-d6j" secondAttribute="centerY" id="4V7-Xp-54n"/>
<constraint firstItem="mgs-nU-6GD" firstAttribute="centerY" secondItem="0U9-LP-d6j" secondAttribute="centerY" id="5P5-6w-pkJ"/>
<constraint firstAttribute="centerX" secondItem="0U9-LP-d6j" secondAttribute="centerX" id="81H-Ii-sbZ"/>
<constraint firstItem="0U9-LP-d6j" firstAttribute="leading" secondItem="mgs-nU-6GD" secondAttribute="trailing" constant="30" id="EXp-MC-v7u"/>
<constraint firstItem="cXW-bq-1DS" firstAttribute="centerY" secondItem="xdf-d7-hOE" secondAttribute="centerY" id="EjK-xm-E25"/>
<constraint firstItem="Ys0-N9-ZWV" firstAttribute="centerY" secondItem="Y9P-e7-eZ5" secondAttribute="centerY" id="HL9-t4-SY6"/>
<constraint firstItem="cXW-bq-1DS" firstAttribute="centerY" secondItem="05f-r8-WNL" secondAttribute="centerY" id="Jbh-wq-ZEd"/>
<constraint firstItem="xQ4-Pw-gO4" firstAttribute="centerX" secondItem="Y9P-e7-eZ5" secondAttribute="centerX" id="Mv7-Yx-fTy"/>
<constraint firstItem="hU0-li-PMo" firstAttribute="centerY" secondItem="SjH-ms-KaO" secondAttribute="centerY" id="UXh-Mc-PIu"/>
<constraint firstItem="xdf-d7-hOE" firstAttribute="centerY" secondItem="86U-zL-BF2" secondAttribute="centerY" id="Uw9-DR-NlG"/>
<constraint firstItem="6V5-ZD-ySN" firstAttribute="centerY" secondItem="Ys0-N9-ZWV" secondAttribute="centerY" id="Vag-41-0IY"/>
<constraint firstItem="AtA-Ag-AzS" firstAttribute="leading" secondItem="0U9-LP-d6j" secondAttribute="trailing" constant="30" id="VbX-Lr-9Dx"/>
<constraint firstItem="mgs-nU-6GD" firstAttribute="centerY" secondItem="Iz2-o9-17H" secondAttribute="centerY" id="YCn-9X-o5f"/>
<constraint firstItem="xdf-d7-hOE" firstAttribute="centerX" secondItem="6V5-ZD-ySN" secondAttribute="centerX" id="YL4-y9-flK"/>
<constraint firstItem="mgs-nU-6GD" firstAttribute="leading" secondItem="Iz2-o9-17H" secondAttribute="trailing" constant="30" id="YpC-8p-aZq"/>
<constraint firstItem="hU0-li-PMo" firstAttribute="centerY" secondItem="6V5-ZD-ySN" secondAttribute="centerY" id="aLB-DF-dsZ"/>
<constraint firstItem="zpA-BY-1sO" firstAttribute="centerY" secondItem="AtA-Ag-AzS" secondAttribute="centerY" id="k9J-02-CyK"/>
<constraint firstItem="86U-zL-BF2" firstAttribute="centerX" secondItem="Ys0-N9-ZWV" secondAttribute="centerX" id="lej-eq-55f"/>
<constraint firstItem="SjH-ms-KaO" firstAttribute="centerX" secondItem="Iz2-o9-17H" secondAttribute="centerX" id="maA-EB-exO"/>
<constraint firstItem="6V5-ZD-ySN" firstAttribute="top" secondItem="0U9-LP-d6j" secondAttribute="bottom" constant="20" id="mqN-VY-gr6"/>
<constraint firstItem="0U9-LP-d6j" firstAttribute="top" secondItem="Q18-jR-H2H" secondAttribute="topMargin" constant="40" id="nJj-pX-ASY"/>
<constraint firstItem="AtA-Ag-AzS" firstAttribute="centerX" secondItem="Ys0-N9-ZWV" secondAttribute="centerX" id="p5d-DZ-JdY"/>
<constraint firstItem="cXW-bq-1DS" firstAttribute="centerX" secondItem="hU0-li-PMo" secondAttribute="centerX" id="pWZ-t7-n3c"/>
<constraint firstItem="05f-r8-WNL" firstAttribute="centerX" secondItem="SjH-ms-KaO" secondAttribute="centerX" id="q0q-Qn-G7i"/>
<constraint firstItem="xQ4-Pw-gO4" firstAttribute="centerY" secondItem="86U-zL-BF2" secondAttribute="centerY" id="qar-Yx-jqc"/>
<constraint firstItem="xdf-d7-hOE" firstAttribute="top" secondItem="6V5-ZD-ySN" secondAttribute="bottom" constant="20" id="tMf-SP-BPd"/>
<constraint firstItem="hU0-li-PMo" firstAttribute="centerX" secondItem="mgs-nU-6GD" secondAttribute="centerX" id="vbh-rS-XRn"/>
<constraint firstItem="zpA-BY-1sO" firstAttribute="centerX" secondItem="Y9P-e7-eZ5" secondAttribute="centerX" id="yem-F2-dSE"/>
</constraints>
</tableViewCellContentView>
<animations/>
</tableViewCell>
@@ -1074,7 +1244,11 @@
</connections>
</tableView>
<connections>
<outlet property="centerLeft1GapConstraint" destination="EXp-MC-v7u" id="XWH-sk-WOf"/>
<outlet property="centerRight1GapConstraint" destination="VbX-Lr-9Dx" id="4pi-0J-Fmi"/>
<outlet property="left1Left2GapConstraint" destination="YpC-8p-aZq" id="NDj-zG-wUl"/>
<outlet property="nicknameTextField" destination="QU0-LQ-GUp" id="Zid-x7-7C0"/>
<outlet property="right1Right2GapConstraint" destination="1lV-M6-3XH" id="HkA-a5-L4K"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KVb-CY-yr0" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -12,6 +12,11 @@ class EditNicknameAndBadgeViewController: UITableViewController {
@IBOutlet weak var nicknameTextField: UITextField!
@IBOutlet weak var centerLeft1GapConstraint: NSLayoutConstraint!
@IBOutlet weak var centerRight1GapConstraint: NSLayoutConstraint!
@IBOutlet weak var left1Left2GapConstraint: NSLayoutConstraint!
@IBOutlet weak var right1Right2GapConstraint: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
@@ -19,6 +24,12 @@ class EditNicknameAndBadgeViewController: UITableViewController {
nicknameTextField.text = YepUserDefaults.nickname.value
nicknameTextField.delegate = self
let gap = UIDevice.matchWidthFrom(10, 25, 32)
centerLeft1GapConstraint.constant = gap
centerRight1GapConstraint.constant = gap
left1Left2GapConstraint.constant = gap
right1Right2GapConstraint.constant = gap
}
}