-
-
Notifications
You must be signed in to change notification settings - Fork 633
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
1 parent
712c10f
commit d99ff77
Showing
5 changed files
with
147 additions
and
2 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
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
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,5 @@ | ||
import UIKit | ||
|
||
class CollectionViewCell: UICollectionViewCell { | ||
@IBOutlet var label: UILabel! | ||
} |
35 changes: 35 additions & 0 deletions
35
Demo/ScrollingNavbarDemo/ViewControllers/CollectionViewController.swift
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,35 @@ | ||
import UIKit | ||
import AMScrollingNavbar | ||
|
||
class CollectionViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { | ||
|
||
@IBOutlet var collectionView: UICollectionView! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
title = "CollectionView" | ||
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .Add, target: nil, action: nil) | ||
navigationController?.navigationBar.barTintColor = UIColor(red:0.91, green:0.3, blue:0.24, alpha:1) | ||
} | ||
|
||
// Enable the navbar scrolling | ||
override func viewDidAppear(animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
if let navigationController = self.navigationController as? ScrollingNavigationController { | ||
navigationController.followScrollView(collectionView, delay: 50.0) | ||
} | ||
} | ||
|
||
// MARK: - Collection view data source | ||
|
||
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { | ||
return 100 | ||
} | ||
|
||
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { | ||
return collectionView.dequeueReusableCellWithReuseIdentifier("CollectionViewCell", forIndexPath: indexPath) | ||
} | ||
|
||
} |