Giter Site home page Giter Site logo

collectionviewcell-animation's Introduction

CollectionViewCell-animation

#What is it?

Delete UICollectionViewCell with Animations.I used CoreAnimation to realize its function.

#How to operate this demo?

Long press cells,until cells vibrate,click the delete button then you can delete the cell what you want.Double click screen can make all cell to normal status.

#How to add it into your project?

1.Drag YTAnimation.h, YTAnimation.m to your project.It is a tool class.

2.Copy those codes to your cell .h file.

3.Copy my codes in Cell.m to your cell .m file,you should pay attention to the following picture.

4.Add those codes to your CollectionViewController

#概述

使用了核心动画里的转场动画和动画组来实现。

#Demo操作

长按cell,出现抖动状态,然后点击左上角叉叉按钮即可删除Cell。双击屏幕即可恢复到原来装态。

#如何应用到自己项目中

1.首先将YTAnimation.h , YTAnimation.m两个文件拖入你的项目中,它相当于是一个工具类。

2.在你的自定义UICollectionViewCell 的 .h文件里,添加图中标出的协议声明和属性。

3.在你的自定义的UICollectionViewCell 的 .m文件里,将我Cell.m 文件里方法实现部分黏贴进去。这里要注意,在方法addDeleteButton方法里用到了一张图片,那张图片在我工程里的Assets.xcassets,不要忘了。如果你已经有实现方法 - (instancetype)initWithCoder:(NSCoder *)aDecoder 那么把这两个方法的调用加到你自己的 inintWithCoder的相应位置。

按照图中说明,调用动画类,选择动画类型。

4.UICollectionView控制器里: 加入如图画圈部分 (注:我这里的控制器直接使用UICollectionViewController, 而不是在UIViewController里拖入 UICollectionView控件)。

至于那个sourceArr是我的数据源,你需要用你自己的数据源去处理。那两个BOOL变量是用来使cell长按抖动和左上角出现叉叉按钮用的。

剩下的按照图中说明即可。

collectionviewcell-animation's People

Contributors

wonderffee avatar yintokey 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.