Custom collection view layout that has the same vertical spacing between all cells.
CHVariableHeightTilesLayout is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "CHVariableHeightTilesLayout"
To install manually, just copy everything in the CHVariableHeightTilesLayout
directory into your Xcode project.
Important: If your project doesn't use ARC you must add the -fobjc-arc
compiler flag to all CHCircleGaugeView implementation files in Target Settings > Build Phases > Compile Sources.
- Instantiate, customize, set yourself as the
dataSource
, and assign to a collection view'scollectionViewLayout
. - Implement both of the
CHVariableHeightTilesLayoutDataSource
protocol methods.
Setup example:
CHVariableHeightTilesLayout *variableHeightTilesLayout = [[CHVariableHeightTilesLayout alloc] init];
variableHeightTilesLayout.topSpacing = 5.0;
variableHeightTilesLayout.bottomSpacing = 5.0;
variableHeightTilesLayout.sideSpacing = 10.0;
variableHeightTilesLayout.horizontalCellSpacing = 20.0;
variableHeightTilesLayout.verticalCellSpacing = 20.0;
variableHeightTilesLayout.dataSource = self;
self.collectionView.collectionViewLayout = variableHeightTilesLayout;
Pull request are welcomed. To add functionality or to make changes:
- Fork this repo.
- Open
CHVariableHeightTilesLayoutExample.xcodeproj
in theCHVariableHeightTilesLayoutExample
directory. - Make changes to the necessary files in the
CHVariableHeightTilesLayout
group. - Ensure new public methods are documented.
- Submit a pull request.
Created by Osama Ashawa, Matthew Morey, Rogelio Gudino, and other contributors.
CHVariableHeightTilesLayout is available under the MIT license. See the LICENSE file for more information. If you're using CHVariableHeightTilesLayout in your project, attribution would be nice.