Explorar el Código

Some styles applied.

Iñigo Valentin hace 9 años
padre
commit
0da54eb011

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


+ 4 - 2
app/HomeView.swift

@@ -76,6 +76,8 @@ class HomeView: UIView {
 		//Populate sections
 		setUpPastActivities(context: moc, delegate: appDelegate, lang: lang, parent: pastActivitiesSection.getContentStack())
 		
+		pastActivitiesSection.resizeToFitSubviews()
+		
 		//Always at the end: update scrollview
 		var h: Int = 0
 		for view in scrollView.subviews {
@@ -129,10 +131,10 @@ class HomeView: UIView {
 				
 				//Create a new row
 				row = RowHomePastActivities.init(s: "rowHomePastActivities", i: count)
-				title = r.value(forKey: "permalink")! as! String
+				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
 				print(title)
-				row.setTitle(text: title)
+				row.setTitle(text: "aa\(title)")
 				row.setText(text: text)
 				
 				parent.addArrangedSubview(row)

+ 5 - 3
app/RowHomePastActivities.swift

@@ -71,8 +71,10 @@ Extension of UIView to be formatted as sections.
 
 		container.frame = v.bounds
 		v.addSubview(container)
-		title.frame = self.bounds
-		container.addSubview(title)
+		
+		
+		
+		
 	}
 	
 	/**
@@ -88,7 +90,7 @@ Extension of UIView to be formatted as sections.
 	*/
 	func setTitle(text: String){
 		print("Setting title: \(text)")
-		//title.text = text
+		title.text = text
 		//descrip.text = text
 	}
 	

+ 30 - 42
app/RowHomePastActivities.xib

@@ -6,7 +6,6 @@
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
-        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -15,7 +14,7 @@
                 <outlet property="container" destination="2hI-rc-KPm" id="rWX-Vl-kOp"/>
                 <outlet property="descrip" destination="f4E-5p-Bid" id="IF5-ck-qUL"/>
                 <outlet property="entry" destination="wLM-VU-VYk" id="Gkq-yE-fdN"/>
-                <outlet property="title" destination="Bkz-DV-HVr" id="L4e-zP-foa"/>
+                <outlet property="title" destination="Bkz-DV-HVr" id="1ok-yI-Npt"/>
             </connections>
         </placeholder>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
@@ -24,53 +23,43 @@
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2hI-rc-KPm" userLabel="Container">
-                    <rect key="frame" x="0.0" y="0.0" width="320" height="320"/>
+                    <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wLM-VU-VYk" userLabel="Entry">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="144"/>
+                            <rect key="frame" x="10" y="10" width="300" height="568"/>
                             <subviews>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="bg" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="8"/>
-                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                    <nil key="textColor"/>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bkz-DV-HVr" userLabel="Title">
+                                    <rect key="frame" x="10" y="10" width="280" height="21.5"/>
+                                    <fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
+                                    <color key="textColor" red="0.13929578993055555" green="0.4641384548611111" blue="0.33924696180555558" alpha="1" colorSpace="calibratedRGB"/>
                                     <nil key="highlightedColor"/>
                                 </label>
-                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
-                                    <rect key="frame" x="0.0" y="8" width="82" height="128"/>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="82" id="AAD-9E-g0I"/>
-                                        <constraint firstAttribute="height" constant="128" id="lU5-Vi-wpM"/>
-                                    </constraints>
+                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="PhotoPlaceholder" translatesAutoresizingMaskIntoConstraints="NO" id="WSe-uz-Uhz" userLabel="Image">
+                                    <rect key="frame" x="10" y="40" width="80" height="64"/>
+                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 </imageView>
-                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f4E-5p-Bid" userLabel="Text">
-                                    <rect key="frame" x="82" y="8" width="150" height="13"/>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="13" id="P3K-Ep-nV1"/>
-                                    </constraints>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" 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"/>
+                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                    <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"/>
                                 </label>
                             </subviews>
-                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                            <color key="backgroundColor" red="1" green="1" blue="0.32001410590277779" alpha="1" colorSpace="calibratedRGB"/>
                             <constraints>
-                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="centerY" secondItem="wLM-VU-VYk" secondAttribute="centerY" id="Hss-ZU-RvF"/>
-                                <constraint firstAttribute="trailing" secondItem="f4E-5p-Bid" secondAttribute="trailing" constant="88" id="SY4-tx-tGD"/>
-                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="Bkz-DV-HVr" secondAttribute="bottom" id="WRT-Ue-SMy"/>
-                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="f4E-5p-Bid" secondAttribute="top" id="XG7-8d-jb8"/>
-                                <constraint firstItem="WSe-uz-Uhz" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="topMargin" id="hug-jJ-gQm"/>
-                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="WSe-uz-Uhz" secondAttribute="leading" id="iSX-2Y-HxN"/>
-                                <constraint firstItem="f4E-5p-Bid" firstAttribute="leading" secondItem="WSe-uz-Uhz" secondAttribute="trailing" id="lSw-Hz-Vr9"/>
-                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" id="pon-Cx-fHh"/>
-                                <constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" id="u6N-aa-Ad6"/>
-                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" id="xaz-VM-PBl"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="leading" secondItem="wLM-VU-VYk" secondAttribute="leading" constant="10" id="LSz-FM-x2V"/>
+                                <constraint firstAttribute="trailing" secondItem="Bkz-DV-HVr" secondAttribute="trailing" constant="10" id="MdM-yF-pmK"/>
+                                <constraint firstItem="Bkz-DV-HVr" firstAttribute="top" secondItem="wLM-VU-VYk" secondAttribute="top" constant="10" id="mwG-d2-HQL"/>
                             </constraints>
+                            <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                             <userDefinedRuntimeAttributes>
                                 <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
                                     <color key="value" red="0.0" green="0.0" blue="0.33810763890000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 </userDefinedRuntimeAttribute>
                                 <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                    <real key="value" value="2"/>
+                                    <real key="value" value="1"/>
                                 </userDefinedRuntimeAttribute>
                                 <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
                                     <real key="value" value="3"/>
@@ -79,10 +68,12 @@
                         </view>
                     </subviews>
                     <constraints>
-                        <constraint firstItem="wLM-VU-VYk" firstAttribute="leading" secondItem="2hI-rc-KPm" secondAttribute="leading" id="4wm-Kd-QZe"/>
-                        <constraint firstItem="wLM-VU-VYk" firstAttribute="top" secondItem="2hI-rc-KPm" secondAttribute="top" id="fmF-H5-bZ9"/>
-                        <constraint firstAttribute="trailing" secondItem="wLM-VU-VYk" secondAttribute="trailing" id="rOM-9n-P02"/>
+                        <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 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>
+                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                     <userDefinedRuntimeAttributes>
                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
                             <real key="value" value="0.0"/>
@@ -91,18 +82,15 @@
                 </view>
             </subviews>
             <constraints>
-                <constraint firstItem="2hI-rc-KPm" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="PMg-Yl-oAA"/>
-                <constraint firstAttribute="trailing" secondItem="2hI-rc-KPm" secondAttribute="trailing" id="WIN-BI-cuJ"/>
-                <constraint firstItem="2hI-rc-KPm" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="a5e-qs-gY9"/>
-                <constraint firstAttribute="bottom" secondItem="2hI-rc-KPm" secondAttribute="bottom" constant="248" id="whR-Gz-dvd"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="height" secondItem="iN0-l3-epB" secondAttribute="height" id="Kwy-25-YES"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="clR-QU-zlD"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="htS-q0-otF"/>
+                <constraint firstItem="2hI-rc-KPm" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="rig-k7-6bz"/>
             </constraints>
             <nil key="simulatedStatusBarMetrics"/>
             <userDefinedRuntimeAttributes>
-                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                    <color key="value" red="0.0" green="0.0" blue="0.3381076388888889" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                </userDefinedRuntimeAttribute>
                 <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                    <real key="value" value="3"/>
+                    <real key="value" value="0.0"/>
                 </userDefinedRuntimeAttribute>
             </userDefinedRuntimeAttributes>
             <point key="canvasLocation" x="46" y="-43"/>

+ 14 - 0
app/Section.swift

@@ -66,4 +66,18 @@ class Section: UIView {
 		lbl.text = "ABBA"
 		content.addSubview(lbl)
 	}
+	
+	func resizeToFitSubviews() {
+		var width: CGFloat = 0
+		var height: CGFloat = 0
+		for someView in self.subviews {
+			let aView = someView
+			let newWidth = aView.frame.origin.x + aView.frame.width
+			let newHeight = aView.frame.origin.y + aView.frame.height
+			width = max(width, newWidth)
+			height = max(height, newHeight)
+		}
+		
+		frame = CGRect(x: frame.origin.x, y: frame.origin.y, width: width, height: height)
+	}
 }