Giter Site home page Giter Site logo

listdemo's Introduction

ListDemo

演示:

demo

基于UICollectionView的列表的实现,看似复杂,但分解之后就是如下的四个部分的文件,而且为了方便重用,做了更为细化的分解。

1. 配置文件

  1. Layout

    1. 主要实现list中cell,footer、header、section的布局。即自定义的layout(系统提供flowlayout亦可使用)

    2. 增删cell时的动画设置

  2. DataSource

    1. 数据源,list展示的数据在此文件中保存(以数组的形式)
    2. 实现UICollectionViewDataSource协议,将必须的数据源方法通过block的形式返回,便于在引用处设置
    3. 实现插入、删除、reload等方法。引用处只需简单调用即可
  3. Delegate

    1. 事件源:将点击、display、size返回等事件以block回调至引用处,方便配置
    2. 实现LayoutDelegate 协议方法,提供Layout必要的布局数据
  4. LayoutDelegate

    1. 通常放在Layout文件中,该协议继承自UICollectionViewDelegate协议
    2. 提供Layout必须的或者非必须的资源,如用来获取cell宽高、footer和header的size属性等

listdemo's People

Contributors

panzhou0b1b avatar

Stargazers

 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.