GithubHelp home page GithubHelp logo

yaole / sxphotoshow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dsxniubility/sxphotoshow

0.0 1.0 0.0 1.12 MB

使用三种自定义布局做的照片秀

License: MIT License

Objective-C 100.00%

sxphotoshow's Introduction

SXPhotoShow

使用三种自定义布局做的照片秀


![image](https://github.com/dsxNiubility/SXPhotoShow/raw/master/screenshots/photo.gif)

UICollectionViewFlowLayout流水布局 是当下collectionView中常用且普通的布局方式。本代码也写了三种好看的布局,其中LineLayout和流水布局有很大的相同点就直接继承UICollectionViewFlowLayout,然后StackLayout,CircleLayout这两种都是直接继承自最原始的UICollectionViewLayout 布局方案。

###SXStackLayout 类似于扑克牌错位叠在一起的布局,暂时能做到的是两边对称。点击cell删除或是cell的数量发生改变时会重新布局,角度也会随之更改产生动画效果。

###SXLineLayout 是一条直线的布局,但是拖动的过程中,cell的大小会根据自己位置的改变而改变,滑到中间时最大,两边时最小。并且做了处理有一个吸附的效果,每次快要停止时都会把最靠近中间的cell放在正中间不歪。

###SXCircleLayout 这是一个环形的布局,位置也是会随着整体数量的改变而改变的。demo设置的是可以点击删除的,亲可以试试在删最后5个的时候会有炫酷效果发生。

####使用方法

1.建立自己需要的项目,里面要先有collectionView和collectionCell(demo里是最朴实的写法)

2.将项目中的Layout文件夹拖入项目中。 里面有三种布局,想用哪种就导入哪种的头文件。
#import "SXStackLayout.h" -- 对应的是上图的顶部
#import "SXLineLayout.h" -- 对应的是上图的中间
#import "SXCircleLayout.h" -- 对应的是上图的下方

3.在ViewDidLoad方法中创建布局
SXCircleLayout *layout = [[SXCircleLayout alloc] init];
并在collection的初始化方法中填上这个引入的布局
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 235)) collectionViewLayout:layout];

sxphotoshow's People

Contributors

dsxniubility avatar

Watchers

 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.