diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 0c99e27..4d5e05a 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -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 = ""; }; - 9349943B1C399D99006C4B97 /* Intro.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Intro.storyboard; sourceTree = ""; }; - 9349943D1C39A5B9006C4B97 /* IntroCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroCollectionViewCell.swift; sourceTree = ""; }; - 9349943E1C39A5B9006C4B97 /* IntroCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IntroCollectionViewCell.xib; sourceTree = ""; }; - 934994411C39B0F4006C4B97 /* SecoundViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecoundViewController.swift; sourceTree = ""; }; - 934994431C39B102006C4B97 /* Secound.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Secound.storyboard; sourceTree = ""; }; + 934994391C399D70006C4B97 /* Pattern1ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pattern1ViewController.swift; sourceTree = ""; }; + 9349943B1C399D99006C4B97 /* Pattern1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Pattern1.storyboard; sourceTree = ""; }; + 9349943D1C39A5B9006C4B97 /* ImageCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCollectionViewCell.swift; sourceTree = ""; }; + 9349943E1C39A5B9006C4B97 /* ImageCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ImageCollectionViewCell.xib; sourceTree = ""; }; + 934994411C39B0F4006C4B97 /* Pattern2ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Pattern2ViewController.swift; sourceTree = ""; }; + 934994431C39B102006C4B97 /* Pattern2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Pattern2.storyboard; sourceTree = ""; }; 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 = ""; }; - 93DC8E3A1BD232CA004BCCBC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 93DC8E3A1BD232CA004BCCBC /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; 93DC8E3D1BD232CA004BCCBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 93DC8E3F1BD232CA004BCCBC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 93DC8E421BD232CA004BCCBC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -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 */, @@ -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; }; @@ -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; }; diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard index 6e20c2a..ab53cef 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Example/Base.lproj/Main.storyboard @@ -21,10 +21,10 @@ - + - + diff --git a/Example/Example/IntroCollectionViewCell.swift b/Example/Example/ImageCollectionViewCell.swift similarity index 66% rename from Example/Example/IntroCollectionViewCell.swift rename to Example/Example/ImageCollectionViewCell.swift index bfef251..416754c 100644 --- a/Example/Example/IntroCollectionViewCell.swift +++ b/Example/Example/ImageCollectionViewCell.swift @@ -1,5 +1,5 @@ // -// IntroCollectionViewCell.swift +// ImageCollectionViewCell.swift // Example // // Created by hiroyuki yoshida on 2016/01/04. @@ -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 diff --git a/Example/Example/IntroCollectionViewCell.xib b/Example/Example/ImageCollectionViewCell.xib similarity index 93% rename from Example/Example/IntroCollectionViewCell.xib rename to Example/Example/ImageCollectionViewCell.xib index 09c026d..d178cd4 100644 --- a/Example/Example/IntroCollectionViewCell.xib +++ b/Example/Example/ImageCollectionViewCell.xib @@ -1,13 +1,12 @@ - - + diff --git a/Example/Example/ViewController.swift b/Example/Example/MainViewController.swift similarity index 83% rename from Example/Example/ViewController.swift rename to Example/Example/MainViewController.swift index 5faa670..d735715 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/MainViewController.swift @@ -1,5 +1,5 @@ // -// ViewController.swift +// MainViewController.swift // Example // // Created by hiroyuki yoshida on 2015/10/17. @@ -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! { @@ -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 } @@ -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) } } diff --git a/Example/Example/Intro.storyboard b/Example/Example/Pattern1.storyboard similarity index 88% rename from Example/Example/Intro.storyboard rename to Example/Example/Pattern1.storyboard index 196e3c5..6728e65 100644 --- a/Example/Example/Intro.storyboard +++ b/Example/Example/Pattern1.storyboard @@ -5,10 +5,10 @@ - + - + @@ -17,9 +17,10 @@ - + - + + diff --git a/Example/Example/IntroViewController.swift b/Example/Example/Pattern1ViewController.swift similarity index 70% rename from Example/Example/IntroViewController.swift rename to Example/Example/Pattern1ViewController.swift index 0cb9eac..05863b2 100644 --- a/Example/Example/IntroViewController.swift +++ b/Example/Example/Pattern1ViewController.swift @@ -1,5 +1,5 @@ // -// IntroViewController.swift +// Pattern1ViewController.swift // Example // // Created by hiroyuki yoshida on 2016/01/04. @@ -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) } } @@ -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 } diff --git a/Example/Example/Secound.storyboard b/Example/Example/Pattern2.storyboard similarity index 84% rename from Example/Example/Secound.storyboard rename to Example/Example/Pattern2.storyboard index 4167b50..a1ea910 100644 --- a/Example/Example/Secound.storyboard +++ b/Example/Example/Pattern2.storyboard @@ -5,10 +5,10 @@ - + - + @@ -21,23 +21,24 @@ - + - + - + + - + @@ -98,27 +99,28 @@ - - + + - + - - - - + + + + + - - + + - + @@ -135,17 +137,8 @@ - - - - - - - - - diff --git a/Example/Example/SecoundViewController.swift b/Example/Example/Pattern2ViewController.swift similarity index 62% rename from Example/Example/SecoundViewController.swift rename to Example/Example/Pattern2ViewController.swift index d4124f3..d6177ad 100644 --- a/Example/Example/SecoundViewController.swift +++ b/Example/Example/Pattern2ViewController.swift @@ -1,5 +1,5 @@ // -// SecoundViewController.swift +// Pattern2ViewController.swift // Example // // Created by hiroyuki yoshida on 2016/01/04. @@ -9,24 +9,25 @@ import UIKit import InfiniteCollectionView -final class SecoundViewController: UIViewController { +final class Pattern2ViewController: UIViewController { - static func createFromStoryboard() -> SecoundViewController { - let storyboard = UIStoryboard(name: "Secound", bundle: nil) - return storyboard.instantiateInitialViewController() as! SecoundViewController + static func createFromStoryboard() -> Pattern2ViewController { + let storyboard = UIStoryboard(name: "Pattern2", bundle: nil) + return storyboard.instantiateInitialViewController() as! Pattern2ViewController } @IBOutlet weak var tableView: UITableView! { didSet { tableView.delegate = self tableView.dataSource = self + tableView.separatorStyle = .None } } } // MARK: - UITableViewDataSource, UITableViewDelegate -extension SecoundViewController: UITableViewDataSource, UITableViewDelegate { +extension Pattern2ViewController: UITableViewDataSource, UITableViewDelegate { func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 2 } @@ -40,15 +41,13 @@ extension SecoundViewController: UITableViewDataSource, UITableViewDelegate { } func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { if indexPath.section == 0 { - let cell = tableView.dequeueReusableCellWithIdentifier(SecoundInfiniteTableViewCell.identifier) as! SecoundInfiniteTableViewCell + let cell = tableView.dequeueReusableCellWithIdentifier(InfiniteTableViewCell.identifier) as! InfiniteTableViewCell return cell } else if indexPath.section == 1 { - let cell = tableView.dequeueReusableCellWithIdentifier(SecoundInfinite2TableViewCell.identifier) as! SecoundInfinite2TableViewCell + let cell = tableView.dequeueReusableCellWithIdentifier(Infinite2TableViewCell.identifier) as! Infinite2TableViewCell return cell } else { - let cell = tableView.dequeueReusableCellWithIdentifier(SecoundTableViewCell.identifier) - cell?.textLabel?.text = String(indexPath.row) - return cell! + return UITableViewCell() } } func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { @@ -61,24 +60,18 @@ extension SecoundViewController: UITableViewDataSource, UITableViewDelegate { } } -final class SecoundTableViewCell: UITableViewCell { - static let identifier = "SecoundTableViewCell" -} - -final class SecoundInfiniteTableViewCell: UITableViewCell { - static let identifier = "SecoundInfiniteTableViewCell" +final class InfiniteTableViewCell: UITableViewCell { + static let identifier = "InfiniteTableViewCell" @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: 239) } } @@ -90,12 +83,12 @@ final class SecoundInfiniteTableViewCell: UITableViewCell { } // MARK: - InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate -extension SecoundInfiniteTableViewCell: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate { +extension InfiniteTableViewCell: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate { func numberOfItems(collectionView: UICollectionView) -> Int { return 4 } 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 } @@ -106,33 +99,25 @@ extension SecoundInfiniteTableViewCell: InfiniteCollectionViewDataSource, Infini } } -final class SecoundInfinite2TableViewCell: UITableViewCell { - static let identifier = "SecoundInfinite2TableViewCell" +final class Infinite2TableViewCell: UITableViewCell { + static let identifier = "Infinite2TableViewCell" @IBOutlet weak var collectionView: InfiniteCollectionView! { didSet { collectionView.infiniteDataSource = self collectionView.infiniteDelegate = self collectionView.cellWidth = 100 - collectionView.registerNib(IntroCollectionViewCell.nib, forCellWithReuseIdentifier: IntroCollectionViewCell.identifier) - } - } - @IBOutlet weak var layout: UICollectionViewFlowLayout! { - didSet { - layout.scrollDirection = .Horizontal - layout.minimumInteritemSpacing = 0 - layout.minimumLineSpacing = 10 - layout.itemSize = CGSize(width: 100, height: 100) + collectionView.registerNib(ImageCollectionViewCell.nib, forCellWithReuseIdentifier: ImageCollectionViewCell.identifier) } } } // MARK: - InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate -extension SecoundInfinite2TableViewCell: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate { +extension Infinite2TableViewCell: InfiniteCollectionViewDataSource, InfiniteCollectionViewDelegate { func numberOfItems(collectionView: UICollectionView) -> Int { return 10 } 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 } diff --git a/InfiniteCollectionView.podspec b/InfiniteCollectionView.podspec index 01c3f05..54afce8 100644 --- a/InfiniteCollectionView.podspec +++ b/InfiniteCollectionView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "InfiniteCollectionView" - s.version = "1.0.1" + s.version = "1.0.2" s.summary = "Infinite Scrolling Using UICollectionView." s.homepage = "https://github.com/hryk224/InfiniteCollectionView" s.screenshots = "https://github.com/hryk224/InfiniteCollectionView/wiki/images/sample1.gif" diff --git a/InfiniteCollectionView/InfiniteCollectionView.swift b/InfiniteCollectionView/InfiniteCollectionView.swift index ba5a5e7..3a681f5 100644 --- a/InfiniteCollectionView/InfiniteCollectionView.swift +++ b/InfiniteCollectionView/InfiniteCollectionView.swift @@ -40,11 +40,6 @@ public class InfiniteCollectionView: UICollectionView { // MARK: - private private extension InfiniteCollectionView { func configure() { - backgroundColor = UIColor.clearColor() - showsHorizontalScrollIndicator = false - showsVerticalScrollIndicator = false - clipsToBounds = true - scrollEnabled = true delegate = self dataSource = self registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: Me.defaultIdentifier)