-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
718 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "0.jpg", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "1.jpg", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "2.jpg", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "3.jpg", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="jtB-7l-rQl"> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Intro View Controller--> | ||
<scene sceneID="w99-5n-3Mx"> | ||
<objects> | ||
<viewController automaticallyAdjustsScrollViewInsets="NO" id="jtB-7l-rQl" customClass="IntroViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController"> | ||
<layoutGuides> | ||
<viewControllerLayoutGuide type="top" id="Vix-Nr-Wbb"/> | ||
<viewControllerLayoutGuide type="bottom" id="rTP-xN-QW3"/> | ||
</layoutGuides> | ||
<view key="view" contentMode="scaleToFill" id="fk8-nc-mgC"> | ||
<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"> | ||
<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"> | ||
<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"/> | ||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> | ||
</collectionViewFlowLayout> | ||
<cells/> | ||
</collectionView> | ||
<view alpha="0.5" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QjU-up-8Sl"> | ||
<rect key="frame" x="0.0" y="543" width="600" height="37"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
<constraints> | ||
<constraint firstAttribute="height" constant="37" id="Pl4-pn-Jed"/> | ||
</constraints> | ||
</view> | ||
<pageControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" numberOfPages="3" translatesAutoresizingMaskIntoConstraints="NO" id="RxI-o2-lRZ"> | ||
<rect key="frame" x="0.0" y="543" width="600" height="37"/> | ||
<constraints> | ||
<constraint firstAttribute="height" constant="37" id="L4v-Uu-0PK"/> | ||
</constraints> | ||
<color key="pageIndicatorTintColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
<color key="currentPageIndicatorTintColor" red="0.75686274509999996" green="0.1960784314" blue="0.15686274510000001" alpha="1" colorSpace="calibratedRGB"/> | ||
</pageControl> | ||
</subviews> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
<constraints> | ||
<constraint firstAttribute="trailing" secondItem="QjU-up-8Sl" secondAttribute="trailing" id="12W-C1-v9R"/> | ||
<constraint firstAttribute="trailing" secondItem="RxI-o2-lRZ" secondAttribute="trailing" id="I7I-K3-VLb"/> | ||
<constraint firstItem="Lwf-cA-VEr" firstAttribute="leading" secondItem="fk8-nc-mgC" secondAttribute="leading" id="NFN-BY-c0F"/> | ||
<constraint firstItem="rTP-xN-QW3" firstAttribute="top" secondItem="Lwf-cA-VEr" secondAttribute="bottom" id="Rm1-Pt-2ET"/> | ||
<constraint firstItem="rTP-xN-QW3" firstAttribute="top" secondItem="RxI-o2-lRZ" secondAttribute="bottom" constant="20" id="fYC-HN-2ix"/> | ||
<constraint firstItem="RxI-o2-lRZ" firstAttribute="leading" secondItem="fk8-nc-mgC" secondAttribute="leading" id="hbP-3L-wxy"/> | ||
<constraint firstItem="Lwf-cA-VEr" firstAttribute="top" secondItem="fk8-nc-mgC" secondAttribute="top" id="mQv-aQ-Qp8"/> | ||
<constraint firstItem="QjU-up-8Sl" firstAttribute="leading" secondItem="fk8-nc-mgC" secondAttribute="leading" id="nv4-jf-hwP"/> | ||
<constraint firstAttribute="trailing" secondItem="Lwf-cA-VEr" secondAttribute="trailing" id="o9s-cD-XIp"/> | ||
<constraint firstItem="rTP-xN-QW3" firstAttribute="top" secondItem="QjU-up-8Sl" secondAttribute="bottom" constant="20" id="oBP-Bl-GPa"/> | ||
</constraints> | ||
</view> | ||
<connections> | ||
<outlet property="collectionView" destination="Lwf-cA-VEr" id="OVu-NX-VQz"/> | ||
<outlet property="layout" destination="9XM-Ng-ou9" id="rvd-rt-iwV"/> | ||
<outlet property="pageControl" destination="RxI-o2-lRZ" id="IaE-F1-N1Z"/> | ||
</connections> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="6qE-8b-tDF" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="584" y="352"/> | ||
</scene> | ||
</scenes> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// IntroCollectionViewCell.swift | ||
// Example | ||
// | ||
// Created by hiroyuki yoshida on 2016/01/04. | ||
// Copyright © 2016年 hiroyuki yoshida. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
final class IntroCollectionViewCell: UICollectionViewCell { | ||
@IBOutlet weak var imageView: UIImageView! | ||
static let identifier = "IntroCollectionViewCell" | ||
static let nib = UINib(nibName: "IntroCollectionViewCell", bundle: nil) | ||
func configure(dequeueIndexPath dequeueIndexPath: NSIndexPath) { | ||
let image = UIImage(named: String(dequeueIndexPath.row)) | ||
imageView.image = image | ||
setNeedsLayout() | ||
layoutIfNeeded() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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"> | ||
<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"> | ||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
<subviews> | ||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6aC-HR-aM0"> | ||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
</imageView> | ||
</subviews> | ||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> | ||
</view> | ||
<constraints> | ||
<constraint firstItem="6aC-HR-aM0" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="hnJ-jX-Q7o"/> | ||
<constraint firstItem="6aC-HR-aM0" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="i9e-jp-U9f"/> | ||
<constraint firstAttribute="bottom" secondItem="6aC-HR-aM0" secondAttribute="bottom" id="uck-YH-fqc"/> | ||
<constraint firstAttribute="trailing" secondItem="6aC-HR-aM0" secondAttribute="trailing" id="yqw-wr-SkO"/> | ||
</constraints> | ||
<connections> | ||
<outlet property="imageView" destination="6aC-HR-aM0" id="4uF-jM-h1C"/> | ||
</connections> | ||
<point key="canvasLocation" x="839" y="363"/> | ||
</collectionViewCell> | ||
</objects> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// IntroViewController.swift | ||
// Example | ||
// | ||
// Created by hiroyuki yoshida on 2016/01/04. | ||
// Copyright © 2016年 hiroyuki yoshida. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import InfiniteCollectionView | ||
|
||
final class IntroViewController: 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 | ||
} | ||
} | ||
@IBOutlet weak var layout: UICollectionViewFlowLayout! { | ||
didSet { | ||
layout.scrollDirection = .Horizontal | ||
layout.itemSize = CGSize(width: UIScreen.mainScreen().bounds.width, height: UIScreen.mainScreen().bounds.height) | ||
} | ||
} | ||
@IBOutlet weak var pageControl: UIPageControl! { | ||
didSet { | ||
pageControl.numberOfPages = items.count | ||
} | ||
} | ||
static func createFromStoryboard() -> IntroViewController { | ||
let storyboard = UIStoryboard(name: "Intro", bundle: nil) | ||
return storyboard.instantiateInitialViewController() as! IntroViewController | ||
} | ||
} | ||
|
||
// MARK: - InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate | ||
extension IntroViewController: 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 | ||
cell.configure(dequeueIndexPath: indexPath) | ||
return cell | ||
} | ||
func didSelectCellAtIndexPath(collectionView: UICollectionView, indexPath: NSIndexPath) { | ||
} | ||
func didUpdatePageIndex(index: Int) { | ||
pageControl.currentPage = index | ||
} | ||
} |
Oops, something went wrong.