Iñigo Valentin před 9 roky
rodič
revize
20722849fc

binární
app.xcodeproj/project.xcworkspace/xcuserdata/seavenois.xcuserdatad/UserInterfaceState.xcuserstate


+ 5 - 24
app/HomeView.swift

@@ -106,7 +106,7 @@ class HomeView: UIView {
 		fetchRequest.sortDescriptors = sortDescriptors
 		//TODO Compare dates
 		//fetchRequest.predicate = NSPredicate(format: "date < %@", sysdate)
-		fetchRequest.fetchLimit = 1//2
+		fetchRequest.fetchLimit = 2
 		
 		do {
 			//go get the results
@@ -118,6 +118,7 @@ class HomeView: UIView {
 			var row : RowHomePastActivities
 			var count = 0;
 			var title : String
+			var text: String
 			
 			//You need to convert to NSManagedObject to use 'for' loops
 			for r in searchResults as [NSManagedObject] {
@@ -127,34 +128,14 @@ class HomeView: UIView {
 				
 				
 				//Create a new row
-				row = RowHomePastActivities.init(s: "rowHomePastActivities", i: count) //frame: CGRect(top: 0, left: 0, width: 200, height: 50)
-				//row = RowHomePastActivities(frame: parent.bounds)
-				//row = RowHomePastActivities.instanceFromNib() as! RowHomePastActivities
-				//row.frame = CGRect(x: 15, y: 15, width: 100, height: 100)
-				//row = RowHomePastActivities(frame: CGRect(x: 13, y: 0, width: 100, height: 100))
+				row = RowHomePastActivities.init(s: "rowHomePastActivities", i: count)
 				title = r.value(forKey: "permalink")! as! String
+				text = r.value(forKey: "text_\(lang)")! as! String
 				print(title)
 				row.setTitle(text: title)
-				//row.backgroundColor = UIColor.red
-				//row.setBounds(rect: parent.bounds)
+				row.setText(text: text)
 				
 				parent.addArrangedSubview(row)
-				//parent.addSubview(row)
-				let lbl = UILabel()
-				lbl.text = "ABBA"
-				//view.addEntry(view: row)
-				parent.addArrangedSubview(lbl)
-				//var testView: UIView = UIView(frame: CGRect(x: 13, y: 13, width: 100, height: 100))
-    //testView.backgroundColor = UIColor.blue
-    //testView.alpha = 0.5
-    //testView.tag = 100
-    //testView.isUserInteractionEnabled = true
-    //parent.addSubview(testView)
-				
-				//parent.addConstraint(NSLayoutConstraint(item: row, attribute: NSLayoutAttribute.right, relatedBy: NSLayoutRelation.equal, toItem: parent, attribute: NSLayoutAttribute.right, multiplier: 1, constant: -10))
-				//Íparent.addConstraint(NSLayoutConstraint(item: row, attribute: NSLayoutAttribute.bottom, relatedBy: NSLayoutRelation.equal, toItem: parent, attribute: NSLayoutAttribute.bottom, multiplier: 1, constant: -10))
-				//row = RowHomePastActivities(s: "rowHomePastActivities", i: count)//Bundle.mainBundle("RowPastActivities").loadNibNamed("", owner: nil, options: nil)[0] as! RowHomePastActivities
-				//row.setupWithSuperView(superView: self)
 				
 			}
 		} catch {

+ 8 - 7
app/HomeView.xib

@@ -30,48 +30,49 @@
                 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-ba-9jX">
                     <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
                     <subviews>
-                        <view alpha="0.20000000000000001" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ljm-NP-c4e" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="0.0" width="320" height="120"/>
+                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.Location.height" id="4XI-rg-Du1"/>
                             </constraints>
                         </view>
-                        <view alpha="0.29999999999999999" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9nu-j1-wGI" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="120" width="320" height="120"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.Lablanca.height" id="B0a-14-gfY"/>
                             </constraints>
                         </view>
-                        <view alpha="0.40000000000000002" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FQo-nm-4Mo" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="240" width="320" height="120"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.FActivity.height" id="AJi-J2-weg"/>
                             </constraints>
                         </view>
-                        <view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uHa-Mu-U68" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="360" width="320" height="120"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.Blog.Height" id="bV3-sl-7SD"/>
                             </constraints>
                         </view>
-                        <view alpha="0.59999999999999998" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v6A-Ya-esA" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="28" y="480" width="320" height="120"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.Gallery.Height" id="vSS-A6-4QV"/>
                             </constraints>
                         </view>
-                        <view alpha="0.69999999999999996" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fZk-r1-Tca" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="160" y="600" width="0.0" height="0.0"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="120" identifier="HomeView.PActivity.height" id="6SU-vG-oBN"/>
                             </constraints>
                         </view>
-                        <view alpha="0.59999999999999998" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app" customModuleProvider="target">
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="dgk-s8-xje" customClass="Section" customModule="app" customModuleProvider="target">
                             <rect key="frame" x="83" y="600" width="320" height="15"/>
                             <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                             <constraints>

+ 18 - 52
app/RowHomePastActivities.swift

@@ -31,91 +31,57 @@ Extension of UIView to be formatted as sections.
 	
 	//The container.
 	@IBOutlet weak var container: UIView!
-	@IBOutlet weak var entry: UIView!
 	
+	//The entry
+	@IBOutlet weak var entry: UIView!
 	
 	//The activity title.
 	@IBOutlet weak var title: UILabel!
-	@IBOutlet weak var descrip: UILabel!
-	
-	
-	
-	
-	//The acvtivity text.
-	
-	
 	
+	//The activity description
+	@IBOutlet weak var descrip: UILabel!
 	
 	/**
-	Run when the section is loaded.
+	Default constructor
 	*/
 	required init?(coder aDecoder: NSCoder) {
 		super.init(coder: aDecoder)
 	}
 	
-	private func loadViewFromNib() -> UIView {
+	private func loadViewFromNib() {
 		let bundle = Bundle(for: type(of: self))
 		let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle)
-		let nibView = nib.instantiate(withOwner: self, options: nil).first as! UIView
-		
-		return nibView
+		nib.instantiate(withOwner: self, options: nil).first as! UIView
 	}
 	
+	/**
+	Default constructor.
+	:param: s Custom identifier
+	:param: i Custom identifier
+	*/
 	init(s: String, i: Int) {
-		//self.s = s
-		//self.i = i
-		super.init(frame: CGRect(x: 20, y: 100, width: 200, height: 450))
-		print("Constructor: Custom")
-		//self.bounds = CGRect(x: 00, y: 0, width: 200, height: 150)
-		//v = loadViewFromNib()
+		super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0))
 		loadViewFromNib()
 		v = self
 		v.frame = bounds
 		v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 		v.translatesAutoresizingMaskIntoConstraints = true
-		v.backgroundColor = UIColor.green
-			//Bundle.main.loadNibNamed("RowHomePastActivities", owner: self, options: nil)
-		//self.addSubview(container)
-		//container.frame = CGRect(x: 20, y: 100, width: 100, height: 150)
-		//container.frame = CGRect(x: 20, y: 0, width: 100, height: 150)
-		container.backgroundColor = UIColor.green
 		container.autoresizingMask = [.flexibleWidth, .flexibleHeight]
 		container.translatesAutoresizingMaskIntoConstraints = true
-		self.backgroundColor = UIColor.red
-		self.borderColor = UIColor.blue
-		self.borderWidth = 3
-		//container.bounds = self.bounds//CGRect(x: 20, y: 100, width: 10, height: 10)
-		//title.frame = self.bounds
-		
-		print("bounds")
-		//title.frame = container.bounds//CGRect(x: 30, y: 150, width: 80, height: 100)
-		//title.frame = CGRect(x: 0, y: 0, width: 50, height: 15)
-		//title.bounds = CGRect(x: 0, y: 0, width: 50, height: 15)
-		//title.bounds = CGRec
-		container.frame = v.frame
-		//container.frame = CGRect(x: self.bounds.origin.x, y: self.bounds.origin.y, width: self.bounds.width, height: self.bounds.height)
+
+		container.frame = v.bounds
 		v.addSubview(container)
 		title.frame = self.bounds
 		container.addSubview(title)
-		//container.autoresizingMask = [UIViewAutoresizing.flexibleWidth, UIViewAutoresizing.flexibleHeight]
-		
-		let lbl = UILabel()
-		lbl.text = "ABBA2"
-		lbl.frame = v.bounds
-		//view.addEntry(view: row)
-		v.addSubview(lbl)
-		
-		
 	}
 	
+	/**
+	Default constructor for the interface builder
+	*/
 	override init(frame: CGRect){
 		super.init(frame: frame)
 	}
 	
-	func setBounds(rect: CGRect){
-		container.bounds = rect
-	}
-	
 	/**
 	Changes the title of the activity.
 	:param: text The new title.

+ 1 - 7
app/RowHomePastActivities.xib

@@ -31,7 +31,6 @@
                             <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"/>
-                                    <color key="backgroundColor" red="0.7046612645" green="1" blue="0.65893771199999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                     <nil key="textColor"/>
                                     <nil key="highlightedColor"/>
@@ -79,23 +78,18 @@
                             </userDefinedRuntimeAttributes>
                         </view>
                     </subviews>
-                    <color key="backgroundColor" red="1" green="0.0" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                     <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"/>
                     </constraints>
                     <userDefinedRuntimeAttributes>
-                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                            <color key="value" red="0.033257378472222224" green="0.0" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        </userDefinedRuntimeAttribute>
                         <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                            <real key="value" value="7"/>
+                            <real key="value" value="0.0"/>
                         </userDefinedRuntimeAttribute>
                     </userDefinedRuntimeAttributes>
                 </view>
             </subviews>
-            <color key="backgroundColor" red="0.0" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
             <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"/>