# RBCollectionViewBalancedColumnLayout **Repository Path**: mirrors/RBCollectionViewBalancedColumnLayout ## Basic Information - **Project Name**: RBCollectionViewBalancedColumnLayout - **Description**: RBCollectionViewBalancedColumnLayout 是个自定义 UICollectionViewLayout,用列来显示单元格,会调整合适的高度 - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/rbcollectionviewbalancedcolumnlayout - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-09 - **Last Updated**: 2026-01-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # BalancedColumnLayout A UICollectionViewLayout that displays your cells in a variable number of columns that fit to the bounds of the CollectionView. Why? Cause every other layout that attempts to mimic the Pintrest waterfall layout (as this does) wants you to set the number of columns from the outside and I wanted my layout to figure that out for me so I didn't have to deal with it in the rotation logic. Also I wanted a single layout setup for iPhone and iPad resolutions, and whatever comes next. ## Usage 1. Copy RBCollectionViewBalancedColumnLayout .h/.m into your project 2. Set the layout on your collectionView to Custom, and set it's name to RBCollectionViewBalancedColumnLayout 3. Implement the collectionView:layout:heightForItemAtIndexPath: delegate method - if you want variable height cells or just set the width like so: ``` objective-c RBCollectionViewBalancedColumnLayout * layout = (id)self.collectionView.collectionViewLayout; layout.cellWidth = 100; ``` ## Screenshots #### Landscape