Skip to content

Instantly share code, notes, and snippets.

@SwiftArchitect
Last active March 20, 2016 15:39
Show Gist options
  • Save SwiftArchitect/e203c4ff4c578e5e4d09 to your computer and use it in GitHub Desktop.
Save SwiftArchitect/e203c4ff4c578e5e4d09 to your computer and use it in GitHub Desktop.
Autolayout & Columns. See the full article at http://swiftarchitect.com/autolayout-columns/, and the StackOverflow question at http://stackoverflow.com/questions/31658526/using-autolayout-to-stack-within-two-columns-of-varying-heights/31804168#31804168. Copyright (c) 2015 Xavier Schott, MIT License
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ObjCSwiftPods" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zYP-uF-Naj" userLabel="2 Columns">
<rect key="frame" x="16" y="28" width="343" height="209"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lzt-Dg-Aq0" userLabel="L">
<rect key="frame" x="8" y="8" width="164" height="193"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 line Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cMz-85-3cO">
<rect key="frame" x="8" y="8" width="148" height="21"/>
<color key="backgroundColor" red="0.40000000596046448" green="0.40000000596046448" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 liner Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jqG-iG-WJE">
<rect key="frame" x="8" y="164" width="148" height="21"/>
<color key="backgroundColor" red="0.80000001192092896" green="0.40000000596046448" blue="1" alpha="0.5" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Multiple lines Label. This may need to fit on an arbritrary number of lines" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Sbx-DM-Qjh">
<rect key="frame" x="8" y="37" width="148" height="120"/>
<color key="backgroundColor" red="1" green="0.0" blue="0.0" alpha="0.25" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.40000000600000002" green="0.80000001190000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="cMz-85-3cO" firstAttribute="leading" secondItem="lzt-Dg-Aq0" secondAttribute="leading" constant="8" id="7Hr-kf-URP"/>
<constraint firstAttribute="trailing" secondItem="Sbx-DM-Qjh" secondAttribute="trailing" constant="8" id="DYI-yl-pZW"/>
<constraint firstItem="jqG-iG-WJE" firstAttribute="top" secondItem="Sbx-DM-Qjh" secondAttribute="bottom" constant="8" id="Gg7-m8-SKe"/>
<constraint firstItem="cMz-85-3cO" firstAttribute="top" secondItem="lzt-Dg-Aq0" secondAttribute="top" constant="8" id="V7V-iq-P17"/>
<constraint firstAttribute="trailing" secondItem="jqG-iG-WJE" secondAttribute="trailing" constant="8" id="XkZ-o6-DgG"/>
<constraint firstAttribute="trailing" secondItem="cMz-85-3cO" secondAttribute="trailing" constant="8" id="cfB-04-cor"/>
<constraint firstItem="Sbx-DM-Qjh" firstAttribute="leading" secondItem="lzt-Dg-Aq0" secondAttribute="leading" constant="8" id="jed-8T-Zxu"/>
<constraint firstAttribute="bottom" secondItem="jqG-iG-WJE" secondAttribute="bottom" constant="8" id="sPI-pj-YLp"/>
<constraint firstItem="Sbx-DM-Qjh" firstAttribute="top" secondItem="cMz-85-3cO" secondAttribute="bottom" constant="8.5" id="t5j-7N-YYj"/>
<constraint firstItem="jqG-iG-WJE" firstAttribute="leading" secondItem="lzt-Dg-Aq0" secondAttribute="leading" constant="8" id="zjp-7z-Jo0"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kSc-Hk-cH9" userLabel="R">
<rect key="frame" x="179" y="8" width="156" height="139"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 line Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fh1-PH-RNU" userLabel="L1">
<rect key="frame" x="8" y="8" width="140" height="30"/>
<color key="backgroundColor" red="0.25098040699958801" green="0.50196081399917603" blue="0.0" alpha="0.5" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="25"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Multiple lines Label. This may need to fit on an arbritrary number of lines" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4CI-ku-IGV" userLabel="L2 (multiple lines)">
<rect key="frame" x="8" y="46" width="140" height="36"/>
<color key="backgroundColor" red="1" green="0.50196081399917603" blue="0.0" alpha="0.5" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Right Bottom Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s8O-aK-Ob2" userLabel="L3">
<rect key="frame" x="8" y="90" width="140" height="41"/>
<color key="backgroundColor" red="1" green="0.43529412150382996" blue="0.81176471710205078" alpha="0.5" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.80000001192092896" green="1" blue="0.40000000596046448" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="s8O-aK-Ob2" firstAttribute="leading" secondItem="kSc-Hk-cH9" secondAttribute="leading" constant="8" id="Ajw-I2-epo"/>
<constraint firstItem="4CI-ku-IGV" firstAttribute="leading" secondItem="kSc-Hk-cH9" secondAttribute="leading" constant="8" id="G3O-xO-Uhi"/>
<constraint firstItem="s8O-aK-Ob2" firstAttribute="top" secondItem="4CI-ku-IGV" secondAttribute="bottom" constant="8" id="G7m-lA-Tb3"/>
<constraint firstItem="Fh1-PH-RNU" firstAttribute="top" secondItem="kSc-Hk-cH9" secondAttribute="top" constant="8" id="Sd2-9y-jcm"/>
<constraint firstItem="4CI-ku-IGV" firstAttribute="top" secondItem="Fh1-PH-RNU" secondAttribute="bottom" constant="8" id="Wqa-tT-McT"/>
<constraint firstAttribute="trailing" secondItem="4CI-ku-IGV" secondAttribute="trailing" constant="8" id="Y8Q-vI-Amh"/>
<constraint firstAttribute="trailing" secondItem="Fh1-PH-RNU" secondAttribute="trailing" constant="8" id="ZFh-uk-xAz"/>
<constraint firstAttribute="trailing" secondItem="s8O-aK-Ob2" secondAttribute="trailing" constant="8" id="bA9-L7-Cud"/>
<constraint firstItem="Fh1-PH-RNU" firstAttribute="leading" secondItem="kSc-Hk-cH9" secondAttribute="leading" constant="8" id="nCT-ra-1XT"/>
<constraint firstAttribute="bottom" secondItem="s8O-aK-Ob2" secondAttribute="bottom" constant="8" id="sYD-9u-SAt"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.94901960780000005" green="0.53333333329999999" blue="0.1019607843" alpha="0.48999999999999999" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" secondItem="lzt-Dg-Aq0" secondAttribute="height" constant="8" id="8Vr-Hg-h9p"/>
<constraint firstItem="kSc-Hk-cH9" firstAttribute="top" secondItem="zYP-uF-Naj" secondAttribute="top" constant="8" id="BlQ-N7-R22"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" secondItem="kSc-Hk-cH9" secondAttribute="height" constant="8" id="CFa-MV-WPK"/>
<constraint firstAttribute="trailing" secondItem="kSc-Hk-cH9" secondAttribute="trailing" constant="8" id="CMX-DP-kNe"/>
<constraint firstItem="kSc-Hk-cH9" firstAttribute="width" secondItem="zYP-uF-Naj" secondAttribute="width" multiplier="0.5" constant="-16" id="Im6-QY-wyx"/>
<constraint firstAttribute="width" secondItem="lzt-Dg-Aq0" secondAttribute="width" multiplier="2" constant="16" id="Luk-My-eCs"/>
<constraint firstItem="lzt-Dg-Aq0" firstAttribute="leading" secondItem="zYP-uF-Naj" secondAttribute="leading" constant="8" id="UnT-rT-0sr"/>
<constraint firstItem="lzt-Dg-Aq0" firstAttribute="top" secondItem="zYP-uF-Naj" secondAttribute="top" constant="8" id="je6-h0-DiM"/>
<constraint firstAttribute="bottom" secondItem="lzt-Dg-Aq0" secondAttribute="bottom" constant="8" id="moE-4L-Iz3"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="COZ-mG-czf" userLabel="Gray">
<rect key="frame" x="16" y="245" width="343" height="402"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="zYP-uF-Naj" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="2VF-gO-xxm"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="COZ-mG-czf" secondAttribute="bottom" constant="20" id="AHH-3f-N1t"/>
<constraint firstItem="COZ-mG-czf" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="KZ7-wQ-iji"/>
<constraint firstItem="zYP-uF-Naj" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="8" id="a0N-yN-XRj"/>
<constraint firstItem="COZ-mG-czf" firstAttribute="top" secondItem="zYP-uF-Naj" secondAttribute="bottom" constant="8" id="dr6-6o-pHz"/>
<constraint firstItem="COZ-mG-czf" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="heR-RQ-gnD"/>
<constraint firstItem="zYP-uF-Naj" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="qLg-QT-vSd"/>
</constraints>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-13.5" y="253.5"/>
</scene>
</scenes>
</document>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment