Skip to content

Commit

Permalink
Small updated
Browse files Browse the repository at this point in the history
  • Loading branch information
hryk224 committed Jan 5, 2016
1 parent 6a48f73 commit 4e8dc7a
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 121 deletions.
56 changes: 28 additions & 28 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@

/* Begin PBXBuildFile section */
49588A0F5E1A5829806CF162 /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C685BA161AB98E8D668D2F26 /* Pods.framework */; };
9349943A1C399D70006C4B97 /* IntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934994391C399D70006C4B97 /* IntroViewController.swift */; };
9349943C1C399D99006C4B97 /* Intro.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9349943B1C399D99006C4B97 /* Intro.storyboard */; };
9349943F1C39A5B9006C4B97 /* IntroCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9349943D1C39A5B9006C4B97 /* IntroCollectionViewCell.swift */; };
934994401C39A5B9006C4B97 /* IntroCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9349943E1C39A5B9006C4B97 /* IntroCollectionViewCell.xib */; };
934994421C39B0F4006C4B97 /* SecoundViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934994411C39B0F4006C4B97 /* SecoundViewController.swift */; };
934994441C39B102006C4B97 /* Secound.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 934994431C39B102006C4B97 /* Secound.storyboard */; };
9349943A1C399D70006C4B97 /* Pattern1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934994391C399D70006C4B97 /* Pattern1ViewController.swift */; };
9349943C1C399D99006C4B97 /* Pattern1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9349943B1C399D99006C4B97 /* Pattern1.storyboard */; };
9349943F1C39A5B9006C4B97 /* ImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9349943D1C39A5B9006C4B97 /* ImageCollectionViewCell.swift */; };
934994401C39A5B9006C4B97 /* ImageCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9349943E1C39A5B9006C4B97 /* ImageCollectionViewCell.xib */; };
934994421C39B0F4006C4B97 /* Pattern2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934994411C39B0F4006C4B97 /* Pattern2ViewController.swift */; };
934994441C39B102006C4B97 /* Pattern2.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 934994431C39B102006C4B97 /* Pattern2.storyboard */; };
93DC8E391BD232CA004BCCBC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93DC8E381BD232CA004BCCBC /* AppDelegate.swift */; };
93DC8E3B1BD232CA004BCCBC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93DC8E3A1BD232CA004BCCBC /* ViewController.swift */; };
93DC8E3B1BD232CA004BCCBC /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93DC8E3A1BD232CA004BCCBC /* MainViewController.swift */; };
93DC8E3E1BD232CA004BCCBC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93DC8E3C1BD232CA004BCCBC /* Main.storyboard */; };
93DC8E401BD232CA004BCCBC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 93DC8E3F1BD232CA004BCCBC /* Assets.xcassets */; };
93DC8E431BD232CA004BCCBC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 93DC8E411BD232CA004BCCBC /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
934994391C399D70006C4B97 /* IntroViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroViewController.swift; sourceTree = "<group>"; };
9349943B1C399D99006C4B97 /* Intro.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Intro.storyboard; sourceTree = "<group>"; };
9349943D1C39A5B9006C4B97 /* IntroCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroCollectionViewCell.swift; sourceTree = "<group>"; };
9349943E1C39A5B9006C4B97 /* IntroCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IntroCollectionViewCell.xib; sourceTree = "<group>"; };
934994411C39B0F4006C4B97 /* SecoundViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecoundViewController.swift; sourceTree = "<group>"; };
934994431C39B102006C4B97 /* Secound.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Secound.storyboard; sourceTree = "<group>"; };
934994391C399D70006C4B97 /* Pattern1ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pattern1ViewController.swift; sourceTree = "<group>"; };
9349943B1C399D99006C4B97 /* Pattern1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Pattern1.storyboard; sourceTree = "<group>"; };
9349943D1C39A5B9006C4B97 /* ImageCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCollectionViewCell.swift; sourceTree = "<group>"; };
9349943E1C39A5B9006C4B97 /* ImageCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ImageCollectionViewCell.xib; sourceTree = "<group>"; };
934994411C39B0F4006C4B97 /* Pattern2ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pattern2ViewController.swift; sourceTree = "<group>"; };
934994431C39B102006C4B97 /* Pattern2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Pattern2.storyboard; sourceTree = "<group>"; };
93DC8E351BD232CA004BCCBC /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
93DC8E381BD232CA004BCCBC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
93DC8E3A1BD232CA004BCCBC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
93DC8E3A1BD232CA004BCCBC /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
93DC8E3D1BD232CA004BCCBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
93DC8E3F1BD232CA004BCCBC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
93DC8E421BD232CA004BCCBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -74,14 +74,14 @@
isa = PBXGroup;
children = (
93DC8E381BD232CA004BCCBC /* AppDelegate.swift */,
93DC8E3A1BD232CA004BCCBC /* ViewController.swift */,
934994411C39B0F4006C4B97 /* SecoundViewController.swift */,
934994431C39B102006C4B97 /* Secound.storyboard */,
934994391C399D70006C4B97 /* IntroViewController.swift */,
9349943D1C39A5B9006C4B97 /* IntroCollectionViewCell.swift */,
9349943E1C39A5B9006C4B97 /* IntroCollectionViewCell.xib */,
93DC8E3A1BD232CA004BCCBC /* MainViewController.swift */,
93DC8E3C1BD232CA004BCCBC /* Main.storyboard */,
9349943B1C399D99006C4B97 /* Intro.storyboard */,
934994391C399D70006C4B97 /* Pattern1ViewController.swift */,
9349943B1C399D99006C4B97 /* Pattern1.storyboard */,
934994411C39B0F4006C4B97 /* Pattern2ViewController.swift */,
934994431C39B102006C4B97 /* Pattern2.storyboard */,
9349943D1C39A5B9006C4B97 /* ImageCollectionViewCell.swift */,
9349943E1C39A5B9006C4B97 /* ImageCollectionViewCell.xib */,
93DC8E3F1BD232CA004BCCBC /* Assets.xcassets */,
93DC8E411BD232CA004BCCBC /* LaunchScreen.storyboard */,
93DC8E441BD232CA004BCCBC /* Info.plist */,
Expand Down Expand Up @@ -168,10 +168,10 @@
files = (
93DC8E431BD232CA004BCCBC /* LaunchScreen.storyboard in Resources */,
93DC8E401BD232CA004BCCBC /* Assets.xcassets in Resources */,
934994441C39B102006C4B97 /* Secound.storyboard in Resources */,
934994401C39A5B9006C4B97 /* IntroCollectionViewCell.xib in Resources */,
934994441C39B102006C4B97 /* Pattern2.storyboard in Resources */,
934994401C39A5B9006C4B97 /* ImageCollectionViewCell.xib in Resources */,
93DC8E3E1BD232CA004BCCBC /* Main.storyboard in Resources */,
9349943C1C399D99006C4B97 /* Intro.storyboard in Resources */,
9349943C1C399D99006C4B97 /* Pattern1.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -230,11 +230,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9349943A1C399D70006C4B97 /* IntroViewController.swift in Sources */,
93DC8E3B1BD232CA004BCCBC /* ViewController.swift in Sources */,
934994421C39B0F4006C4B97 /* SecoundViewController.swift in Sources */,
9349943A1C399D70006C4B97 /* Pattern1ViewController.swift in Sources */,
93DC8E3B1BD232CA004BCCBC /* MainViewController.swift in Sources */,
934994421C39B0F4006C4B97 /* Pattern2ViewController.swift in Sources */,
93DC8E391BD232CA004BCCBC /* AppDelegate.swift in Sources */,
9349943F1C39A5B9006C4B97 /* IntroCollectionViewCell.swift in Sources */,
9349943F1C39A5B9006C4B97 /* ImageCollectionViewCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
</objects>
<point key="canvasLocation" x="-460" y="511"/>
</scene>
<!--View Controller-->
<!--Main View Controller-->
<scene sceneID="1Kl-4d-wQ0">
<objects>
<viewController id="9lV-Re-kOd" customClass="ViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="9lV-Re-kOd" customClass="MainViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="2b4-Bh-NFz"/>
<viewControllerLayoutGuide type="bottom" id="WMJ-rH-CQa"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// IntroCollectionViewCell.swift
// ImageCollectionViewCell.swift
// Example
//
// Created by hiroyuki yoshida on 2016/01/04.
Expand All @@ -8,10 +8,10 @@

import UIKit

final class IntroCollectionViewCell: UICollectionViewCell {
final class ImageCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
static let identifier = "IntroCollectionViewCell"
static let nib = UINib(nibName: "IntroCollectionViewCell", bundle: nil)
static let identifier = "ImageCollectionViewCell"
static let nib = UINib(nibName: "ImageCollectionViewCell", bundle: nil)
func configure(dequeueIndexPath dequeueIndexPath: NSIndexPath) {
let image = UIImage(named: String(dequeueIndexPath.row))
imageView.image = image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="IntroCollectionViewCell" id="gTV-IL-0wX" customClass="IntroCollectionViewCell" customModule="Example" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ImageCollectionViewCell" id="gTV-IL-0wX" customClass="ImageCollectionViewCell" customModule="Example" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ViewController.swift
// MainViewController.swift
// Example
//
// Created by hiroyuki yoshida on 2015/10/17.
Expand All @@ -9,7 +9,7 @@
import UIKit
import InfiniteCollectionView

final class ViewController: UIViewController {
final class MainViewController: UIViewController {
var patterns = ["pattern1", "pattern2"]
let identifier = "tableViewCell"
@IBOutlet weak var tableView: UITableView! {
Expand All @@ -29,7 +29,7 @@ final class ViewController: UIViewController {
}
}

extension ViewController: UITableViewDelegate, UITableViewDataSource {
extension MainViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return patterns.count
}
Expand All @@ -40,10 +40,10 @@ extension ViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row == 0 {
let controller = IntroViewController.createFromStoryboard()
let controller = Pattern1ViewController.createFromStoryboard()
navigationController?.pushViewController(controller, animated: true)
} else if indexPath.row == 1 {
let controller = SecoundViewController.createFromStoryboard()
let controller = Pattern2ViewController.createFromStoryboard()
navigationController?.pushViewController(controller, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--Intro View Controller-->
<!--Pattern1 View Controller-->
<scene sceneID="w99-5n-3Mx">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="jtB-7l-rQl" customClass="IntroViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<viewController automaticallyAdjustsScrollViewInsets="NO" id="jtB-7l-rQl" customClass="Pattern1ViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Vix-Nr-Wbb"/>
<viewControllerLayoutGuide type="bottom" id="rTP-xN-QW3"/>
Expand All @@ -17,9 +17,10 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Lwf-cA-VEr" customClass="InfiniteCollectionView" customModule="InfiniteCollectionView">
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Lwf-cA-VEr" customClass="InfiniteCollectionView" customModule="InfiniteCollectionView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="9XM-Ng-ou9">
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="9XM-Ng-ou9">
<size key="itemSize" width="600" height="600"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// IntroViewController.swift
// Pattern1ViewController.swift
// Example
//
// Created by hiroyuki yoshida on 2016/01/04.
Expand All @@ -9,20 +9,18 @@
import UIKit
import InfiniteCollectionView

final class IntroViewController: UIViewController {
final class Pattern1ViewController: UIViewController {
var items = ["1", "2", "3", "4"]
@IBOutlet weak var collectionView: InfiniteCollectionView! {
didSet {
collectionView.infiniteDataSource = self
collectionView.infiniteDelegate = self
collectionView.cellWidth = UIScreen.mainScreen().bounds.width
collectionView.registerNib(IntroCollectionViewCell.nib, forCellWithReuseIdentifier: IntroCollectionViewCell.identifier)
collectionView.pagingEnabled = true
collectionView.registerNib(ImageCollectionViewCell.nib, forCellWithReuseIdentifier: ImageCollectionViewCell.identifier)
}
}
@IBOutlet weak var layout: UICollectionViewFlowLayout! {
didSet {
layout.scrollDirection = .Horizontal
layout.itemSize = CGSize(width: UIScreen.mainScreen().bounds.width, height: UIScreen.mainScreen().bounds.height)
}
}
Expand All @@ -31,19 +29,19 @@ final class IntroViewController: UIViewController {
pageControl.numberOfPages = items.count
}
}
static func createFromStoryboard() -> IntroViewController {
let storyboard = UIStoryboard(name: "Intro", bundle: nil)
return storyboard.instantiateInitialViewController() as! IntroViewController
static func createFromStoryboard() -> Pattern1ViewController {
let storyboard = UIStoryboard(name: "Pattern1", bundle: nil)
return storyboard.instantiateInitialViewController() as! Pattern1ViewController
}
}

// MARK: - InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate
extension IntroViewController: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate {
extension Pattern1ViewController: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate {
func numberOfItems(collectionView: UICollectionView) -> Int {
return items.count
}
func cellForItemAtIndexPath(collectionView: UICollectionView, dequeueIndexPath: NSIndexPath, indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(IntroCollectionViewCell.identifier, forIndexPath: dequeueIndexPath) as! IntroCollectionViewCell
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(ImageCollectionViewCell.identifier, forIndexPath: dequeueIndexPath) as! ImageCollectionViewCell
cell.configure(dequeueIndexPath: indexPath)
return cell
}
Expand Down
Loading

0 comments on commit 4e8dc7a

Please sign in to comment.