GithubHelp home page GithubHelp logo

quarezz / erjustifiedflowlayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eroth/erjustifiedflowlayout

0.0 2.0 0.0 1.57 MB

A subclass of UICollectionViewFlowLayout for iOS that supports different types of cell justification and inter-cell spacing.

License: MIT License

Ruby 6.70% Objective-C 93.30%

erjustifiedflowlayout's Introduction

ERJustifiedFlowLayout

[![CI Status](http://img.shields.io/travis/Evan Roth/ERJustifiedFlowLayout.svg?style=flat)](https://travis-ci.org/Evan Roth/ERJustifiedFlowLayout) Version License Platform

About

This is for an iOS project and can be used on any iPad or iPhone. ERJustifiedFlowLayout is a subclass of Apple's UICollectionViewFlowLayout class, which is designed to be used in combination with a UICollectionView. This project assumes you are familiar with the latter—if not, you can read about UICollectionView here and you can read about UICollectionViewFlowLayout here.

ERJustifiedFlowLayout works with dynamic or static-sized UICollectionViewCells, as it only handles the layout aspect.

This project contains some code from the following sources: Michael Sand's answer to a question on SO and this Cocoanetics tutorial. Thanks for the inspiration!

Usage

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

Requirements

Tested on iOS 7 and 8 on all iPads and iPhones from 4S to 6+.

Installation

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

pod "ERJustifiedFlowLayout"

Instructions

ERJustifiedFlowLayout can be used programmatically in the viewDidLoad method of the view controller your collection view is in:

ERJustifiedFlowLayout *flowLayout = [[ERJustifiedFlowLayout alloc] init];

or a reference to it can be created from your xib/storyboard like so:

alt text

Once instantiated or referenced, ERJustifiedFlowLayout requires only the setting of one property, with a few others as options:

  • Required: FlowLayoutHorizontalJustification—an enum on ERJustifiedFlowLayout that sets the type of horizontal justification to perform:
    • FlowLayoutHorizontalJustificationLeft
    • FlowLayoutHorizontalJustificationFull
    • FlowLayoutHorizontalJustificationRight
  • Optional
    • horizontalCellPadding: controls the amount of absolute space between each cell. Default is 0. This property overrides the minimumInteritemSpacing property on UICollectionViewFlowLayout.
    • sectionInset: this UICollectionViewFlowLayout property can be set to provide left, right, top, and bottom section insets which are used in calculating cell justification.

Screenshots

Sublime's custom image
This depicts the following settings:
FlowLayoutHorizontalJustificationLeft, left section inset = 20, horizontalCellPadding = 5

Sublime's custom image
This depicts the following settings:
FlowLayoutHorizontalJustificationFull, left/right section inset = 20, horizontalCellPadding = 5

Sublime's custom image
This depicts the following settings:
FlowLayoutHorizontalJustificationRight, right section inset = 20, horizontalCellPadding = 5

Improvements

Ability to vertically align cells (top, middle, bottom) is coming soon, as is the ability to horizontally center justify cells.

Author

Evan Roth, [email protected]

License

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

erjustifiedflowlayout's People

Contributors

eroth avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.