Sfoglia il codice sorgente

Got all the constraints right for the Home Past activities section.

Iñigo Valentin 9 anni fa
parent
commit
43e59f5584

+ 3 - 3
Section.xib

@@ -31,8 +31,8 @@
                             <fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
                             <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                         </textView>
-                        <stackView autoresizesSubviews="NO" opaque="NO" contentMode="scaleAspectFit" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="hhU-TV-XGc" userLabel="Content">
-                            <rect key="frame" x="0.0" y="27" width="355" height="620"/>
+                        <stackView opaque="NO" contentMode="scaleAspectFit" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="hhU-TV-XGc" userLabel="Content">
+                            <rect key="frame" x="0.0" y="27" width="355" height="600"/>
                             <color key="backgroundColor" red="0.59607843137254901" green="0.78431372549019607" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                         </stackView>
                     </subviews>
@@ -43,7 +43,7 @@
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="leading" secondItem="hhU-TV-XGc" secondAttribute="leading" id="5pZ-0J-Mc4"/>
                         <constraint firstItem="hhU-TV-XGc" firstAttribute="top" secondItem="e7S-aL-6Ed" secondAttribute="top" constant="27" id="GaL-O1-uum"/>
                         <constraint firstAttribute="trailing" secondItem="hhU-TV-XGc" secondAttribute="trailing" id="IEf-ra-MWR"/>
-                        <constraint firstAttribute="bottom" secondItem="hhU-TV-XGc" secondAttribute="bottom" id="LWh-iK-25D"/>
+                        <constraint firstAttribute="bottom" secondItem="hhU-TV-XGc" secondAttribute="bottom" constant="20" id="LWh-iK-25D"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="leading" secondItem="e7S-aL-6Ed" secondAttribute="leading" id="PeJ-Ts-OCF"/>
                         <constraint firstItem="mYX-eR-Wot" firstAttribute="top" secondItem="e7S-aL-6Ed" secondAttribute="top" id="f9V-iV-6wB"/>
                     </constraints>

BIN
app.xcodeproj/project.xcworkspace/xcuserdata/seavenois.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
app/HomeView.swift

@@ -131,7 +131,7 @@ class HomeView: UIView {
 				
 				
 				//Create a new row
-				row = RowHomePastActivities.init(s: "rowHomePastActivities", i: count)
+				row = RowHomePastActivities.init(s: "rowHomePastActivities\(count)", i: count)
 				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
 				print(title)

+ 2 - 6
app/HomeView.xib

@@ -48,15 +48,11 @@
                                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
                                     <rect key="frame" x="0.0" y="0.0" width="320" height="10"/>
                                 </view>
-                                <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
+                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app">
                                     <rect key="frame" x="0.0" y="10" width="320" height="350"/>
-                                    <color key="backgroundColor" red="0.13929578989999999" green="0.4641384549" blue="0.33924696180000002" alpha="1" colorSpace="calibratedRGB"/>
                                     <userDefinedRuntimeAttributes>
-                                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                            <color key="value" red="0.60846421630000003" green="0.58038871199999997" blue="0.12541175830000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                        </userDefinedRuntimeAttribute>
                                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                            <real key="value" value="5"/>
+                                            <real key="value" value="0.0"/>
                                         </userDefinedRuntimeAttribute>
                                     </userDefinedRuntimeAttributes>
                                 </view>

+ 6 - 3
app/RowHomePastActivities.xib

@@ -35,12 +35,14 @@
                                     <color key="textColor" red="0.15294117647058825" green="0.33333333333333331" blue="0.45098039215686275" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
                                     <rect key="frame" x="10" y="40" width="89" height="64"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="64" id="EJ3-uo-Xp3"/>
+                                    </constraints>
                                 </imageView>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
                                     <rect key="frame" x="98" y="40" width="214" height="64"/>
-                                    <color key="backgroundColor" red="1" green="0.2033420138888889" blue="0.32001410590277779" alpha="1" colorSpace="calibratedRGB"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
@@ -75,6 +77,7 @@
                     <constraints>
                         <constraint firstItem="wLM-VU-VYk" firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="10" id="39K-W7-EIE"/>
                         <constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" constant="10" id="HSF-55-R5c"/>
+                        <constraint firstAttribute="height" constant="120" id="PdT-5v-I0r"/>
                         <constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" constant="10" id="fWN-oO-QzS"/>
                         <constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" constant="10" id="teN-oh-Db9"/>
                     </constraints>

+ 1 - 1
app/Section.swift

@@ -65,7 +65,7 @@ class Section: UIView {
 		print("Bounds: \(self.bounds)")
 		print("Frame: \(self.frame)")
 		print("Subviews: \(self.subviews)")
-		//sizeToFit()
+		sizeToFit()
 	}
 	
 	func addEntry(view : UIView){