Skip to content

Commit b318fd8

Browse files
committed
Added ExampleViewController as TableViewController and added VerticalLayoutVC as first example
1 parent 22d1173 commit b318fd8

File tree

5 files changed

+149
-24
lines changed

5 files changed

+149
-24
lines changed

Example/ScrollableStackView.xcodeproj/project.pbxproj

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
06E5F9431E0C7DA3002AB744 /* ExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06E5F9421E0C7DA3002AB744 /* ExampleViewController.swift */; };
11+
06E5F9451E0C8053002AB744 /* VerticalLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06E5F9441E0C8053002AB744 /* VerticalLayoutViewController.swift */; };
12+
06E5F9471E0C8067002AB744 /* HorizontalLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06E5F9461E0C8067002AB744 /* HorizontalLayoutViewController.swift */; };
1013
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
11-
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
1214
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
1315
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
1416
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
@@ -28,14 +30,16 @@
2830
/* End PBXContainerItemProxy section */
2931

3032
/* Begin PBXFileReference section */
33+
06E5F9421E0C7DA3002AB744 /* ExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleViewController.swift; sourceTree = "<group>"; };
34+
06E5F9441E0C8053002AB744 /* VerticalLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticalLayoutViewController.swift; sourceTree = "<group>"; };
35+
06E5F9461E0C8067002AB744 /* HorizontalLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HorizontalLayoutViewController.swift; sourceTree = "<group>"; };
3136
1075CFADC42A1B77F5FF1954 /* Pods_ScrollableStackView_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ScrollableStackView_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3237
27AF6CAA888B6895C44FCD0E /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
3338
2916A2B9EB97F1BBE92FEB53 /* Pods-ScrollableStackView_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ScrollableStackView_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ScrollableStackView_Tests/Pods-ScrollableStackView_Tests.debug.xcconfig"; sourceTree = "<group>"; };
3439
4D72C9861B1AB87530B84A1A /* Pods-ScrollableStackView_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ScrollableStackView_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-ScrollableStackView_Example/Pods-ScrollableStackView_Example.release.xcconfig"; sourceTree = "<group>"; };
3540
607FACD01AFB9204008FA782 /* ScrollableStackView_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScrollableStackView_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
3641
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3742
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
38-
607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
3943
607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
4044
607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
4145
607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
@@ -105,10 +109,9 @@
105109
isa = PBXGroup;
106110
children = (
107111
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
108-
607FACD71AFB9204008FA782 /* ViewController.swift */,
109-
607FACD91AFB9204008FA782 /* Main.storyboard */,
110-
607FACDC1AFB9204008FA782 /* Images.xcassets */,
111-
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
112+
06E5F9421E0C7DA3002AB744 /* ExampleViewController.swift */,
113+
06E5F9441E0C8053002AB744 /* VerticalLayoutViewController.swift */,
114+
06E5F9461E0C8067002AB744 /* HorizontalLayoutViewController.swift */,
112115
607FACD31AFB9204008FA782 /* Supporting Files */,
113116
);
114117
name = "Example for ScrollableStackView";
@@ -118,6 +121,9 @@
118121
607FACD31AFB9204008FA782 /* Supporting Files */ = {
119122
isa = PBXGroup;
120123
children = (
124+
607FACD91AFB9204008FA782 /* Main.storyboard */,
125+
607FACDC1AFB9204008FA782 /* Images.xcassets */,
126+
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
121127
607FACD41AFB9204008FA782 /* Info.plist */,
122128
);
123129
name = "Supporting Files";
@@ -362,8 +368,10 @@
362368
isa = PBXSourcesBuildPhase;
363369
buildActionMask = 2147483647;
364370
files = (
365-
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
371+
06E5F9451E0C8053002AB744 /* VerticalLayoutViewController.swift in Sources */,
366372
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
373+
06E5F9471E0C8067002AB744 /* HorizontalLayoutViewController.swift in Sources */,
374+
06E5F9431E0C7DA3002AB744 /* ExampleViewController.swift in Sources */,
367375
);
368376
runOnlyForDeploymentPostprocessing = 0;
369377
};
Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="iyO-1W-12E">
33
<device id="retina5_5" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
@@ -8,23 +8,55 @@
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99
</dependencies>
1010
<scenes>
11-
<!--View Controller-->
12-
<scene sceneID="ufC-wZ-h7g">
11+
<!--Example View Controller-->
12+
<scene sceneID="szN-Cb-GDr">
1313
<objects>
14-
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="ScrollableStackView_Example" customModuleProvider="target" sceneMemberID="viewController">
14+
<tableViewController id="iyO-1W-12E" customClass="ExampleViewController" customModule="ScrollableStackView_Example" customModuleProvider="target" sceneMemberID="viewController">
15+
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="eZe-G7-ypE">
16+
<rect key="frame" x="0.0" y="64" width="414" height="672"/>
17+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
19+
<prototypes>
20+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="bUr-eS-XDZ">
21+
<rect key="frame" x="0.0" y="28" width="414" height="44"/>
22+
<autoresizingMask key="autoresizingMask"/>
23+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bUr-eS-XDZ" id="R13-Wp-JUw">
24+
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
25+
<autoresizingMask key="autoresizingMask"/>
26+
</tableViewCellContentView>
27+
</tableViewCell>
28+
</prototypes>
29+
<connections>
30+
<outlet property="dataSource" destination="iyO-1W-12E" id="6dT-ru-6jS"/>
31+
<outlet property="delegate" destination="iyO-1W-12E" id="IuM-Ka-XYW"/>
32+
</connections>
33+
</tableView>
34+
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" translucent="NO" prompted="NO"/>
35+
<refreshControl key="refreshControl" opaque="NO" multipleTouchEnabled="YES" contentMode="center" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="WPM-Qd-TGu">
36+
<autoresizingMask key="autoresizingMask"/>
37+
</refreshControl>
38+
</tableViewController>
39+
<placeholder placeholderIdentifier="IBFirstResponder" id="d3v-rG-j6g" userLabel="First Responder" sceneMemberID="firstResponder"/>
40+
</objects>
41+
<point key="canvasLocation" x="-1483" y="-55"/>
42+
</scene>
43+
<!--Vertical Layout View Controller-->
44+
<scene sceneID="qhS-Y9-vB6">
45+
<objects>
46+
<viewController storyboardIdentifier="VerticalLayoutViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="cHT-b1-igH" customClass="VerticalLayoutViewController" customModule="ScrollableStackView_Example" customModuleProvider="target" sceneMemberID="viewController">
1547
<layoutGuides>
16-
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
17-
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
48+
<viewControllerLayoutGuide type="top" id="axl-jF-YLJ"/>
49+
<viewControllerLayoutGuide type="bottom" id="JXk-Ob-Wfi"/>
1850
</layoutGuides>
19-
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
51+
<view key="view" contentMode="scaleToFill" id="exB-Wu-Cts">
2052
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
21-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
22-
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
53+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
54+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2355
</view>
2456
</viewController>
25-
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
57+
<placeholder placeholderIdentifier="IBFirstResponder" id="x2W-aS-xJR" userLabel="First Responder" sceneMemberID="firstResponder"/>
2658
</objects>
27-
<point key="canvasLocation" x="33" y="33"/>
59+
<point key="canvasLocation" x="-820" y="-53"/>
2860
</scene>
2961
</scenes>
3062
</document>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//
2+
// ExampleViewController.swift
3+
// ScrollableStackView
4+
//
5+
// Created by G on 23/12/2016.
6+
// Copyright © 2016 CocoaPods. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class ExampleViewController: UITableViewController {
12+
13+
let kCellIdentifier = "CellIdentifier"
14+
let demos = ["Vertical Layout", "Horizondal Layout"]
15+
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
19+
self.title = "ScrollableStackView iOS Demos"
20+
21+
self.tableView?.register(UITableViewCell.self, forCellReuseIdentifier: kCellIdentifier)
22+
}
23+
24+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
25+
let cell = tableView.dequeueReusableCell(withIdentifier: kCellIdentifier)! as UITableViewCell
26+
27+
cell.textLabel?.text = demos[indexPath.row]
28+
29+
return cell
30+
}
31+
32+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
33+
return demos.count
34+
}
35+
36+
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
37+
if indexPath.row == 0 {
38+
let storyboard = UIStoryboard(name: "Main", bundle: nil)
39+
let controller = storyboard.instantiateViewController(withIdentifier: "VerticalLayoutViewController") as! VerticalLayoutViewController
40+
self.present(controller, animated: true, completion: nil)
41+
}
42+
// } else if indexPath.row == 1 {
43+
// let storyboard = UIStoryboard(name: "Main", bundle: nil)
44+
// let controller = storyboard.instantiateViewController(withIdentifier: "HorizontalLayoutViewController") as! HorizontalLayoutViewController
45+
// self.present(controller, animated: true, completion: nil)
46+
47+
48+
// }
49+
}
50+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// HorizontalLayoutViewController.swift
3+
// ScrollableStackView
4+
//
5+
// Created by G on 23/12/2016.
6+
// Copyright © 2016 CocoaPods. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class HorizontalLayoutViewController: UIViewController {
12+
13+
override func viewDidLoad() {
14+
super.viewDidLoad()
15+
16+
// Do any additional setup after loading the view.
17+
}
18+
19+
override func didReceiveMemoryWarning() {
20+
super.didReceiveMemoryWarning()
21+
// Dispose of any resources that can be recreated.
22+
}
23+
24+
25+
/*
26+
// MARK: - Navigation
27+
28+
// In a storyboard-based application, you will often want to do a little preparation before navigation
29+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
30+
// Get the new view controller using segue.destinationViewController.
31+
// Pass the selected object to the new view controller.
32+
}
33+
*/
34+
35+
}

Example/ScrollableStackView/ViewController.swift renamed to Example/ScrollableStackView/VerticalLayoutViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//
2-
// ViewController.swift
2+
// VerticalLayoutViewController.swift
33
// ScrollableStackView
44
//
5-
// Created by Gürhan Yerlikaya on 12/15/2016.
6-
// Copyright (c) 2016 Gürhan Yerlikaya. All rights reserved.
5+
// Created by G on 23/12/2016.
6+
// Copyright © 2016 CocoaPods. All rights reserved.
77
//
88

99
import UIKit
1010
import ScrollableStackView
1111

12-
class ViewController: UIViewController {
12+
class VerticalLayoutViewController: UIViewController {
1313

1414
var didSetupConstraints = false
1515
var scrollable: ScrollableStackView!
@@ -40,7 +40,7 @@ class ViewController: UIViewController {
4040

4141
label.sizeToFit()
4242
scrollable.stackView.addArrangedSubview(label)
43-
43+
4444
view.setNeedsUpdateConstraints()
4545

4646
self.perform(#selector(jumpToView), with: nil, afterDelay: 3.0)
@@ -60,7 +60,7 @@ class ViewController: UIViewController {
6060

6161
didSetupConstraints = true
6262
}
63-
63+
6464
super.updateViewConstraints()
6565
}
6666

0 commit comments

Comments
 (0)