Pop-Up Collection View
Pop-Up Collection View is a replacement for the traditional navigation collection view style and is written in Swift.
- Fast and lightweight
- Preserves content animations (see below)
Pop-Up Collection View mimics the behavior of a normal collection view. Instantiate via code or in the interface builder. Do not forget to set the delegate and data source.
// Init Pop-Up Collection View let popUpCollectionView = PopUpCollectionView(frame: CGRectZero) popUpCollectionView.delegate = self popUpCollectionView.dataSource = self
var delegate: PopUpCollectionViewDelegate var dataSource: PopUpCollectionViewDataSource
Refreshes Pop-Up Collection View.
func popUpCollectionView(popUpCollectionView: PopUpCollectionView, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
Pop-Up Collection View dynamically sets its cells. This method asks the delegate for the size of the content at the given index path. Put in any size, and Pop-Up Collection View will automatically scale it to fit its layout.
func setStatusBarHidden(hidden: Bool)
Implement this method to hide/reveal the status bar. (See the demo for implementation)
func popUpCollectionView(popUpCollectionView: PopUpCollectionView, numberOfItemsInSection section: Int) -> Int
Set the number of items in each section. Note that Pop-Up Collection View works best when there is only one section as section headers are currently not supported.
func popUpCollectionView(popUpCollectionView: PopUpCollectionView, contentViewAtIndexPath indexPath: NSIndexPath) -> UIView
Asks the data source for the content view for a given index path. This can be any implementation of a UIView.
func popUpCollectionView(popUpCollectionView: PopUpCollectionView, infoViewForItemAtIndexPath indexPath: NSIndexPath) -> UIView
Asks the data source for the info view for the given index path. Set the view's frame to the size for when it is displayed. Pop-Up Collection View will automatically handle scaling.
Pop-Up Collection View preserves content animations during transitions. This was tested using FLAnimatedImage.
Note, this does not work with an UIImage extension such as SwiftGif.
To run the example project, clone the repo, and run
pod install from the Example directory first.
- Swift 3.0+
- iOS 9.0+
PopUpCollectionView is available through CocoaPods. To install it, simply add the following line to your Podfile:
use_frameworks! pod "PopUpCollectionView"
Pop-Up Collection View is still in beta and should not be considered stable.
See the LICENSE file for more info.