Latest 0.0.1
Homepage https://github.com/sciasxp/LBNCollectionViewHandler
License MIT
Platforms ios 7.1, requires ARC
Authors

[![CI Status](http://img.shields.io/travis/Luciano Bastos Nunes/LBNCollectionViewHandler.svg?style=flat)](https://travis-ci.org/Luciano Bastos Nunes/LBNCollectionViewHandler)
Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

LBNCollectionViewHandler is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "LBNCollectionViewHandler"

Author

Luciano Bastos Nunes, [email protected]

License

LBNCollectionViewHandler is available under the MIT license. See the LICENSE file for more info.

Usage

Include the file LBNCollectionViewHandler.h in your class:

#import LBNCollectionViewHandler.h

After including LBNCollectionViewHandler.h in the class so you can use it, you need to create a global property to keep reference to LBNCollectionViewHndler instance that can be made this way:

@property (nonatomic, strong) LBNCollectionViewHandler *mainCollectionViewHandler;

And this is how you can use it:


NSDictionary *sections = 
@{@"sections":
    @[
        @{@"headerConfig":@{@"title":@"Novidades"},
        @"items":@[@"Title 1", @"Title 2"]}
     ]
};

self.mainCollectionViewHandler = [LBNCollectionViewHandler allloc] initWithItems:<NSARRAY WITH THE ITENS TO BE SHOWN IN THE TABLE VIEW OR A NSDICTIONARY WITH THE ABOVE FORMAT> CellIdentifier:^NSString *(id item) {

    return <RETURN CELL IDENTIFIER, AS IN YOUR COLLECTIONVIEWCELL AT STORYBOARD, FOR AN ITEM>;

} ConfigureCell:^(id cell, id item, NSIndexPath *indexPath) {

    <CONFIGURE YOUR CELL AS WANTED>

} DeleteCell:<NOT IMPLEMENTED YET. USE NIL> HeightForItem:^CGFloat(id item) {

    return <RETURN CELL HEIGHT FOR AN ITEM>;

} DidSelect:^(NSIndexPath *indexPath, id item) {

    <WHAT TO DO WHEN A ITEM IS SELECTED IN THE COLLECTION>

} ViewForSectionHeader:^UIView *(NSInteger section, id item) {

    <CREATE AND RETURN THE VIEW THAT WILL BE A HEADER FOR THIS SECTION>

    //OBS: <<item>> is the content of headerConfig key

} HeightForHeader:^CGFloat(NSInteger, id) {

    <RETURN THE HEIGHT FOR THIS SECTIONS HEADER>

    //OBS: <<item>> is the content of headerConfig key
}

self.mainCollectionView.dataSource = self.mainCollectionViewHandler;
self.mainCollectionView.delegate = self.mainCollectionViewHandler;
self.mainCollectionViewHeader.enableDeselectOnDidSelect = YES; //It will automatically deselect a cell

OBS: Everything in between "<>" are instructions and have to be replaced by your code.

Latest podspec

{
    "name": "LBNCollectionViewHandler",
    "version": "0.0.1",
    "summary": "A Small implementation for CollectionView dalegate and datasource that will handle most of the boiler plate code.",
    "description": "This pod encapsulate the methods of UICollectionViewDataSource and UICollectionViewDelegate, so you can concentrate on the logic instead of the boiler plate code.nThis pod make use of blocks to make your code simpler and more readable.",
    "homepage": "https://github.com/sciasxp/LBNCollectionViewHandler",
    "license": "MIT",
    "authors": {
        "Luciano Bastos Nunes": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sciasxp/LBNCollectionViewHandler.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "7.1"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "LBNCollectionViewHandler": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This