Latest 0.1.2
License MIT
Platforms ios 7.0, requires ARC

The KPCollectionViewManager’s design philosophy is based on the RETableViewManager, because the author of the RETableViewManager does not provide a code wrapper for the CollectionView, so I wrap the CollectionView with reference to the RETableViewManager. Remove the extra code, keep the core code, which is KPCollectionViewManager, you can use KPCollectionViewManager the same as the RETableViewManager.

Quick Example

Get your UICollectionView up and running in several lines of code:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.collectionViewFlowLayout = [[UICollectionViewFlowLayout alloc] init];
    self.collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:self.collectionViewFlowLayout];
    [self.view addSubview:self.collectionView];

    self.collectionViewManager = [[KPCollectionViewManager alloc] initWithCollectionView:self.collectionView delegate:self];

    //register item and cell, item must be a subclass of KPCollectionViewItem, cell must be a subclass of KPCollectionViewCell.
    self.collectionViewManager[@"KPTestCollectionViewItem"] = @"KPTestCollectionViewCell";
    //register headerItem and headerView, headerItem must be a subclass of KPCollectionReusableViewItem, headerView must be a subclass of KPCollectionHeaderView.
    self.collectionViewManager[@"KPTestCollectionViewHeaderItem"] = @"KPTestCollectionHeaderView";
    //register footerItem and footerView, footerItem must be a subclass of KPCollectionReusableViewItem, footerView must be a subclass of KPCollectionFooterView.
    self.collectionViewManager[@"KPTestCollectionViewFooterItem"] = @"KPTestCollectionFooterView";

    // Cell and Header and Footer is being assigned an automatic identifier
    // You can manually set it if you want to:
    // cellItem.cellIdentifier = @"CustomCellIdentifier";
    // headerItem.reuseIdentifier = @"CustomHeaderReuseIdentifier";
    // footerItem.reuseIdentifier = @"CustomFooterReuseIdentifier";
    // You'll need to register a cell class for it as well:
    // [self.collectionView registerClass:[CustomCell class] forCellWithReuseIdentifier:cellItem.cellIdentifier];
    // [self.collectionView registerClass:[CustomHeader class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:headerItem.reuseIdentifier];
    // [self.collectionView registerClass:[CustomFooter class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:footerItem.reuseIdentifier];

    // Add a section
    KPCollectionViewSection *section = [[KPCollectionViewSection alloc] init];
    [self.collectionViewManager addSection:section];

    // Add items
    for (int i = 0; i < 20; i++) {
        KPTestCollectionViewItem *item = [[KPTestCollectionViewItem alloc] init];
        item.itemNumber = i;
        item.cellSize = CGSizeMake(100, 100);
        item.selectionHandler = ^(id item) {
            KPTestCollectionViewItem *testItem = item;
            NSLog(@"click itemNumber = %d", testItem.itemNumber);
        item.moveHandler = ^BOOL(id item, NSIndexPath *originalIndexPath, NSIndexPath *proposedIndexPath) {
            return YES;
        [section addItem:item];

    KPTestCollectionViewHeaderItem *headerItem = [[KPTestCollectionViewHeaderItem alloc] init];
    headerItem.reusableViewSize = CGSizeMake(100, 100);
    section.headerItem = headerItem;

    KPTestCollectionViewFooterItem *footerItem = [[KPTestCollectionViewFooterItem alloc] init];
    footerItem.reusableViewSize = CGSizeMake(100, 100);
    section.footerItem = footerItem;



Build and run the KPCollectionViewManagerExample.xcworkspace in Xcode.



pod ‘KPCollectionViewManager’

Latest podspec

    "name": "KPCollectionViewManager",
    "version": "0.1.2",
    "summary": "Powerful data driven content manager for UICollectionView.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "SG-UNGroup": "[email protected]"
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "0.1.2"
    "source_files": "KPCollectionViewManager/**/*",
    "requires_arc": true

Pin It on Pinterest

Share This