Latest 0.1.3
Homepage https://github.com/coder-zjq/JQCollectionViewAlignLayout
License MIT
Platforms ios 6.0
Authors

Version
License
Platform

Example

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

Alignment

alignment demo image
JQCollectionViewItemAlignmentFlow(default) JQCollectionViewAlignLayout
JQCollectionViewItemAlignmentLeft JQCollectionViewAlignLayout
JQCollectionViewItemAlignmentRight JQCollectionViewAlignLayout
JQCollectionViewItemAlignmentCenter JQCollectionViewAlignLayout
JQCollectionViewItemAlignmentTile JQCollectionViewAlignLayout

Requirements

iOS 6.0 +

Installation

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

pod 'JQCollectionViewAlignLayout'

Usage

  1. init the collectionView with JQCollectionViewAlignLayout
JQCollectionViewAlignLayout *layout = [[JQCollectionViewAlignLayout alloc] init];
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
  1. setup the itemAlignment
    
    // you can set the itemAlignment for all sections by this:
    layout.itemAlignment = JQCollectionViewItemAlignmentLeft;

// if you want set different itemAlignment for sections, you can do like this:
// 1. conforms to protocol JQCollectionViewAlignLayoutDelegate
@interface JQViewController () < UICollectionViewDataSource, JQCollectionViewAlignLayoutDelegate>

// 2. implement the protocol method

  • (JQCollectionViewItemAlignment)collectionView:(UICollectionView )collectionView layout:(JQCollectionViewAlignLayout )layout itemAlignmentInSection:(NSInteger)section {
    // return the JQCollectionViewItemAlignment in section.
    }

  1. the rest is the same as UICollectionViewFlowLayout.

Author

coder-zjq, [email protected]

License

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

Latest podspec

{
    "name": "JQCollectionViewAlignLayout",
    "version": "0.1.3",
    "summary": "Align left, center, right and tile UICollectionView layout.",
    "description": "Align left, center, right and tile UICollectionView layout based on UICollectionViewFlowLayout.",
    "homepage": "https://github.com/coder-zjq/JQCollectionViewAlignLayout",
    "screenshots": [
        "https://raw.githubusercontent.com/Coder-ZJQ/JQCollectionViewAlignLayout/master/images/align-left.png",
        "https://raw.githubusercontent.com/Coder-ZJQ/JQCollectionViewAlignLayout/master/images/align-center.png",
        "https://raw.githubusercontent.com/Coder-ZJQ/JQCollectionViewAlignLayout/master/images/align-right.png",
        "https://raw.githubusercontent.com/Coder-ZJQ/JQCollectionViewAlignLayout/master/images/tile.png"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "coder-zjq": "[email protected]"
    },
    "source": {
        "git": "https://github.com/coder-zjq/JQCollectionViewAlignLayout.git",
        "tag": "0.1.3"
    },
    "platforms": {
        "ios": "6.0"
    },
    "source_files": "JQCollectionViewAlignLayout/Classes/**/*"
}

Pin It on Pinterest

Share This