CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Dec 2014 |
Maintained by Peter Meyers.
| Depends on: | |
| PMUtils | >= 0 |
| PMCircularCollectionView | >= 0 |
PMBrowsingCollectionView is a subclass of UICollectionView that implements a new interaction for easily browsing through a collection of cells by introducing the concept of expanded vs. collapsed sections.
To install, simply add the following line to your Podfile.
platform :ios, '7.0'
pod "PMBrowsingCollectionView"To see PMBrowsingCollectionView in action, run the example project at /Example/PMBrowsingCollectionView-iOSExample.xcworkspace. After installing the PMBrowsingCollectionView pod, integrating into your project is as easy as creating a typical UICollectionView:
UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new];
layout.scrollDirection = UICollectionViewScrollDirectionVertical;
layout.minimumInteritemSpacing = 2.0f;
layout.minimumLineSpacing = 2.0f;
PMBrowsingCollectionView *collectionView = [PMBrowsingCollectionView collectionViewWithFrame:self.view.bounds
collectionViewLayout:layout];
collectionView.delegate = self;
collectionView.dataSource = self;
[collectionView registerClass:[UICollectionViewCell class]
forCellWithReuseIdentifier:@"cellReuseIdentifier"];
[collectionView registerClass:[UICollectionReusableView class]
forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
withReuseIdentifier:@"headerReuseIdentifier"];
[self.view addSubview:collectionView];
- (UICollectionViewCell *)collectionView:(PMBrowsingCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cellReuseIdentifier" forIndexPath:indexPath];
NSUInteger normalizedIndex = [collectionView normalizeItemIndex:indexPath.item forSection:indexPath.section];
/*
* Configure cell based on indexPath.section and normalizedIndex
*/
return cell;
}PMBrowsingCollectionViewDelegate adds three optional methods to the UICollectionViewDelegateFlowLayout:
- (CGFloat) collectionView:(PMBrowsingCollectionView *)collectionView shadowRadiusForSection:(NSInteger)section
{
return 20.0f;
}
- (UIColor *) collectionView:(PMBrowsingCollectionView *)collectionView shadowColorForSection:(NSInteger)section
{
return [UIColor blackColor];
}
// Only called when section is in a collapsed state.
- (void) collectionView:(PMBrowsingCollectionView *)collectionView willCenterItemAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger normalizedIndex = [collectionView normalizeIndex:indexPath.item];
DLog(@"Will center cell at section index %d, item index %d", indexPath.section, normalizedIndex);
}
PMBrowsingCollectionView is available under the MIT license. See the LICENSE file for more info.