Selaa lähdekoodia

Problems managing two sections.

Iñigo Valentin 9 vuotta sitten
vanhempi
sitoutus
7260b36afa
4 muutettua tiedostoa jossa 12 lisäystä ja 12 poistoa
  1. 2 2
      app/Base.lproj/Main.storyboard
  2. 5 5
      app/BlogView.swift
  3. 3 3
      app/BlogView.xib
  4. 2 2
      app/ViewController.swift

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

@@ -63,7 +63,7 @@
                                 </collectionViewFlowLayout>
                                 <cells>
                                     <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="a4j-DF-epb" customClass="MenuCollectionViewCell" customModule="app" customModuleProvider="target">
-                                        <rect key="frame" x="0.0" y="-3" width="100" height="50"/>
+                                        <rect key="frame" x="0.0" y="-2.5" width="100" height="50"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                             <rect key="frame" x="0.0" y="0.0" width="100" height="50"/>
@@ -274,7 +274,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" customClass="BlogView" customModule="app" customModuleProvider="target">
+                    <view key="view" contentMode="scaleToFill" id="c4t-ul-w0Z">
                         <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"/>

+ 5 - 5
app/BlogView.swift

@@ -64,7 +64,7 @@ class BlogView: UIView {
 		let sortDescriptors = [sortDescriptor]
 		fetchRequest.sortDescriptors = sortDescriptors
 		
-		do {
+		/*do {
 			//go get the results
 			let searchResults = try context.fetch(fetchRequest)
 			
@@ -120,7 +120,7 @@ class BlogView: UIView {
 			}
 		} catch {
 			print("Error with request: \(error)")
-		}
+		}*/
 		
 		//Always at the end: update scrollview
 		var h: Int = 0
@@ -130,15 +130,15 @@ class BlogView: UIView {
 			print("Blog 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
 		
 		
-		let viewController = UIApplication.topViewController() as! ViewController
+		//let viewController = UIApplication.topViewController() as! ViewController
 		
-		viewController.showPost(id: 4)
+		//viewController.showPost(id: 4)
 		
 		
 	}

+ 3 - 3
app/BlogView.xib

@@ -25,12 +25,12 @@
                     <rect key="frame" x="0.0" y="0.0" width="320" height="2500"/>
                     <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="2200"/>
+                            <rect key="frame" x="0.0" y="0.0" width="320" height="22"/>
                             <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="2200"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="22"/>
                                     <constraints>
-                                        <constraint firstAttribute="height" constant="2200" id="dig-UC-mt1"/>
+                                        <constraint firstAttribute="height" constant="22" id="dig-UC-mt1"/>
                                     </constraints>
                                 </view>
                             </subviews>

+ 2 - 2
app/ViewController.swift

@@ -31,7 +31,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 
 	//Each of the sections of the app.
 	@IBOutlet weak var containerViewGallery: UIView!
-	@IBOutlet weak var containerViewBlog: BlogView!
+	@IBOutlet weak var containerViewBlog: UIView!
 	@IBOutlet weak var containerViewActivities: UIView!
 	@IBOutlet weak var containerViewLablanca: UIView!
 	@IBOutlet weak var containerViewLocation: UIView!
@@ -57,7 +57,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 		self.containerViewLocation.alpha = 0
 		self.containerViewLablanca.alpha = 0
 		self.containerViewActivities.alpha = 0
-		self.containerViewBlog.alpha = 0
+		self.containerViewBlog.alpha = 0.5
 		self.containerViewGallery.alpha = 0
 				
 		print("ViewController:viewDidLoad()")