Coder Social home page Coder Social logo

vitonzhang / cchexagonflowlayout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyrilchandelier/cchexagonflowlayout

0.0 1.0 0.0 7.66 MB

UICollectionView layout for both horizontal and vertical management of hexagonal cells

License: MIT License

Ruby 2.06% Objective-C 97.94%

cchexagonflowlayout's Introduction

CCHexagonFlowLayout

UICollectionView layout for both horizontal and vertical management of hexagonal cells

ScreenShot

##Screenshots

ScreenShot - ScreenShot

##Installation

There are two ways to use the library in your project:

  1. Manually add the library files to your project
  • CCHexagonFlowLayout.h
  • CCHexagonFlowLayout.m
  1. Using CocoaPods
pod 'CCHexagonFlowLayout'

##Usage

Begin with the creation of an instance of the CCHexagonFlowLayout

// Build layout
CCHexagonFlowLayout *layout = [[CCHexagonFlowLayout alloc] init];
layout.delegate = self;

Choose an orientation

layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
// OR
layout.scrollDirection = UICollectionViewScrollDirectionVertical;

Configure these variables according to your own hexagonal cells:

// Should be negative in order to reduce the space between hexagon and obtain the hive effect
layout.minimumInteritemSpacing = -30.0f;

// You must find the correct value to obtain the desired effect
layout.minimumLineSpacing = 10.0f;

// Your cell size as a square
layout.itemSize = CGSizeMake(230, 200);

// The gap is a positive float that will be use to obtain the hive effect
layout.gap = 76.0f;

Default flow layout options can be used for header/footer supplementary views and sections

layout.headerReferenceSize = CGSizeMake(320, 50);
layout.footerReferenceSize = CGSizeMake(320, 50);
layout.sectionInset = UIEdgeInsetsMake(20.0f, 20.0f, 20.0f, 20.0f);

##Tests

  • Works fine with iOS7 on iPhone 3.5" and 4" and iPad
  • Not tested on iOS6

##Contribute

The component has been developed for a single project, feel free to contribute to improve it.

cchexagonflowlayout's People

Contributors

cyrilchandelier avatar yyjim avatar

Watchers

vitonzhang 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.