Giter Club home page Giter Club logo

kytilephotolayout's Introduction

KYTilePhotoLayout

CocoaPods Version License Platform

A UICollectionViewLayout with a really interesting image layout algorithm.

一个图片布局算法,实现图片的不规则排列,并且大小不一。具体效果如图:

Algorithm introduce article:

算法介绍文章:

Blog

##垂直滚动:Vertical Scroll

##水平滚动:Horizontal Scroll

##Installation

pod 'KYTilePhotoLayout', '~> 1.0.0'

##How to use

It's just two files: KYTilePhotoLayout.h && KYTilePhotoLayout.m. And it's the subclass of UICollectionViewLayout.So you can easily use like a normal UICollectionViewLayout. eg:

###*Use code:

    KYTilePhotoLayout *tileLayout = [[KYTilePhotoLayout alloc]init];
    tileLayout.ColOfPortrait  = 2;
    tileLayout.ColOfLandscape = 3;
    tileLayout.LayoutDirection =  Vertical;
    self.collectionView.collectionViewLayout = tileLayout;

###*Use Interface Builder:

Set the layout's class to KYTilePhotoLayout .Then you can set the value visibly:

##How to invoke transition between Portrait and Landscape:

In you ViewController:

#pragma mark -- RotateToReLayout
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
    
    [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
    
    KYTilePhotoLayout *layout = (KYTilePhotoLayout *)self.collectionView.collectionViewLayout;
    [layout invalidateLayout];
}

##License This project is under MIT License. See LICENSE file for more information.

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.