Explorar el Código

Both sections can now coexist.

Iñigo Valentin hace 9 años
padre
commit
5af69593d8
Se han modificado 4 ficheros con 27 adiciones y 34 borrados
  1. 2 6
      app/Base.lproj/Main.storyboard
  2. 11 10
      app/BlogView.swift
  3. 9 16
      app/BlogView.xib
  4. 5 2
      app/ViewController.swift

+ 2 - 6
app/Base.lproj/Main.storyboard

@@ -142,10 +142,6 @@
                                     <segue destination="Bxe-vP-zrv" kind="embed" id="ufh-fQ-2yF"/>
                                 </connections>
                             </containerView>
-                            <containerView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bdj-h9-Qx6" userLabel="Container View Gallery">
-                                <rect key="frame" x="0.0" y="55" width="320" height="458"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                            </containerView>
                         </subviews>
                         <color key="backgroundColor" red="0.0" green="0.47058823529411764" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
@@ -274,7 +270,7 @@
                         <viewControllerLayoutGuide type="top" id="yir-Ne-huf"/>
                         <viewControllerLayoutGuide type="bottom" id="126-8G-plw"/>
                     </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z">
+                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z" customClass="BlogView" customModule="app" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="458"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" red="0.70980392156862748" green="0.82745098039215681" blue="0.89803921568627454" alpha="1" colorSpace="calibratedRGB"/>
@@ -282,7 +278,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iDB-bY-1MG" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1643" y="1803"/>
+            <point key="canvasLocation" x="2081" y="2157"/>
         </scene>
         <!--Gallery-->
         <scene sceneID="Uqp-if-ZuD">

+ 11 - 10
app/BlogView.swift

@@ -47,6 +47,8 @@ class BlogView: UIView {
 		
 		super.init(coder: aDecoder)
 		
+		print("BLOG:DEBUG: init.")
+		
 		//Load the contents of the HomeView.xib file.
 		Bundle.main.loadNibNamed("BlogView", owner: self, options: nil)
 		self.addSubview(container)
@@ -64,12 +66,12 @@ class BlogView: UIView {
 		let sortDescriptors = [sortDescriptor]
 		fetchRequest.sortDescriptors = sortDescriptors
 		
-		/*do {
+		do {
 			//go get the results
 			let searchResults = try context.fetch(fetchRequest)
 			
 			//I like to check the size of the returned results!
-			print ("Post: \(searchResults.count)")
+			print ("BLOG:DEBUG: Total posts: \(searchResults.count)")
 			
 			var row : RowBlog
 			var count = 0
@@ -82,7 +84,7 @@ class BlogView: UIView {
 			for r in searchResults as [NSManagedObject] {
 				count = count + 1
 				//get the Key Value pairs (although there may be a better way to do that...
-				print("Perm: \(r.value(forKey: "permalink"))")
+				print("BLOG:DEBUG: Post perm: \(r.value(forKey: "permalink"))")
 				
 				
 				//Create a new row
@@ -90,7 +92,6 @@ class BlogView: UIView {
 				id = r.value(forKey: "id")! as! Int
 				title = r.value(forKey: "title_\(lang)")! as! String
 				text = r.value(forKey: "text_\(lang)")! as! String
-				print(title)
 				row.setTitle(text: title)
 				row.setText(text: text)
 				
@@ -106,31 +107,31 @@ class BlogView: UIView {
 					let imgSearchResults = try context.fetch(imgFetchRequest)
 					for imgR in imgSearchResults as [NSManagedObject]{
 						image = imgR.value(forKey: "image")! as! String
-						print ("IMAGE: \(image)")
+						print ("BLOG:DEBUG: Image: \(image)")
 						row.setImage(filename: image)
 					}
 				} catch {
 					print("Error getting image for post \(id): \(error)")
 				}
 				
-				print("Row height: \(row.frame.height)")
+				print("BLOG:DEBUG: Row height: \(row.frame.height)")
 				
 				parent.addArrangedSubview(row)
 				
 			}
 		} catch {
-			print("Error with request: \(error)")
-		}*/
+			print("BLOG:ERROR: Error with request: \(error)")
+		}
 		
 		//Always at the end: update scrollview
 		var h: Int = 0
 		for view in scrollView.subviews {
 			//contentRect = contentRect.union(view.frame);
 			h = h + Int(view.frame.height) + 30 //Why 30?
-			print("Blog curh: \(h)")
+			print("BLOG:DEBUG: curh: \(h)")
 		}
 		// TODO: Calculate at the end
-		//self.scrollView.contentSize.height = 2500//CGFloat(h);
+		self.scrollView.contentSize.height = 2500//CGFloat(h);
 		
 		// The view controller
 		//var viewController: ViewController  = self.window?.rootViewController as! ViewController

+ 9 - 16
app/BlogView.xib

@@ -9,7 +9,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BlogView" customModule="app" customModuleProvider="target">
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BlogView" customModule="app">
             <connections>
                 <outlet property="container" destination="iN0-l3-epB" id="Nzq-0W-kDj"/>
                 <outlet property="scrollView" destination="V2d-fd-cjO" id="0Px-EW-La0"/>
@@ -21,32 +21,25 @@
             <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
-                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" misplaced="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2d-fd-cjO">
-                    <rect key="frame" x="0.0" y="0.0" width="320" height="2500"/>
+                <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V2d-fd-cjO">
+                    <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
                     <subviews>
-                        <stackView contentMode="scaleToFill" misplaced="YES" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Iqa-PQ-TOo">
-                            <rect key="frame" x="0.0" y="0.0" width="320" height="22"/>
+                        <stackView contentMode="scaleToFill" axis="vertical" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Iqa-PQ-TOo">
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="2200"/>
                             <subviews>
                                 <view autoresizesSubviews="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xlt-p5-m6w" customClass="Section" customModule="app">
-                                    <rect key="frame" x="0.0" y="0.0" width="320" height="22"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="2200"/>
                                     <constraints>
-                                        <constraint firstAttribute="height" constant="22" id="dig-UC-mt1"/>
+                                        <constraint firstAttribute="height" constant="2200" id="dig-UC-mt1" userLabel="height = 2200"/>
                                     </constraints>
+                                    <edgeInsets key="layoutMargins" top="8" left="8" bottom="8" right="8"/>
                                 </view>
                             </subviews>
-                            <color key="backgroundColor" red="0.16731770830000001" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
                             <constraints>
                                 <constraint firstItem="xlt-p5-m6w" firstAttribute="top" secondItem="Iqa-PQ-TOo" secondAttribute="top" id="ARG-5x-hIU"/>
                                 <constraint firstAttribute="bottom" secondItem="xlt-p5-m6w" secondAttribute="bottom" id="EIU-Wo-4hn"/>
+                                <constraint firstAttribute="height" constant="2200" id="FSh-mk-71J"/>
                             </constraints>
-                            <userDefinedRuntimeAttributes>
-                                <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
-                                    <color key="value" red="1" green="0.20334201390000001" blue="0.32001410590000001" alpha="1" colorSpace="calibratedRGB"/>
-                                </userDefinedRuntimeAttribute>
-                                <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
-                                    <real key="value" value="2"/>
-                                </userDefinedRuntimeAttribute>
-                            </userDefinedRuntimeAttributes>
                         </stackView>
                     </subviews>
                     <constraints>

+ 5 - 2
app/ViewController.swift

@@ -57,11 +57,14 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		self.containerViewLocation.alpha = 0
 		self.containerViewLablanca.alpha = 0
 		self.containerViewActivities.alpha = 0
-		self.containerViewBlog.alpha = 0.5
+		self.containerViewBlog.alpha = 0
 		self.containerViewGallery.alpha = 0
+		
+		//self.containerViewBlog.isHidden = true
 				
 		print("ViewController:viewDidLoad()")
-		Sync()
+		print("CONTROLLER:DEBUG: Skyp sync")
+		//Sync()
 		
 		super.viewDidLoad()
 		// Do any additional setup after loading the view, typically from a nib.