FlexibleCollectionView
is a subclass of UICollectionView
, and easy to implement devideable photo viewer like view.
Example of using in ViewController.
let layout = FlexibleCollectionViewLayout()
// The number of rows
layout.rows = 4
// The space between items
layout.spacing = 15
// Animation duration
layout.duration = 0.4
layout.sectionInset = UIEdgeInsets(top: 15, left: 15, bottom: 15, right: 15)
collectionView.layout = layout
collectionView.delegate = self
collectionView.dataSource = self
collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "CELL")
view.addSubview(collectionView)
FlexibleCollectionViewLayout
is inherited from UICollectionViewFlowLayout
, and these properties are available.
Property name | Description |
---|---|
rows | The number of row |
maximumRows | The maximum row count |
minimumRows | The minimum row count |
spacing | The space between items |
duration | Animation duration |
animationEnabled | animation flag |
FlexibleCollectionView can use the following delegate
.
@objc public protocol FlexibleCollectionViewDelegate: UICollectionViewDelegate {
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, willSwipeViewFor direction: UISwipeGestureRecognizerDirection)
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didSwipeViewFor direction: UISwipeGestureRecognizerDirection)
@objc optional func flexibleCollectionView(_ collectionView: FlexibleCollectionView, didFinishAnimation: Bool)
}
XCode8+
Swift3
pod "FlexibleCollectionView"
and
$ pod install
Ryo Ishikawa, [email protected]
FlexibleCollectionView is available under the MIT license. See the LICENSE file for more info.