Code Monkey home page Code Monkey logo

makercycleview's Introduction

MakerCycleView

很容易修改的无限轮播

cycle

使用

  1. MakerCycleView轮播的视图传一个图片的数组
  2. 添加MakerCycleView 并设置 frame

控件的层级关系

cycleVie

实现思路

  1. 选择 scrollView 还是 CollectionView呢?

    CollectionView系统给实现了复用机制,不用担心性能问题. scrollView 要考虑复用机制,实现起来更麻烦.所以选择CollectionView

  2. 怎么实现无限循环呢?

    思路一: CollectionView 把数据源放大到一万倍,让它一直滚啊滚.(不浪费么?) 思路二: CollectionView 滚动到数据源的最后一张图片的时候,让其悄悄滚动的初始位置.

    对比:思路二不浪费,但是肯定会有卡顿感.思路一:用户应该不会没事儿一直盯着看它,看它是否能滚到头,CollectionView实现了复用机制,不会太浪费太多内存就采用这个方式吧.

写代码

  1. 自定义 MakerCycleView 并创建CollectionView 和 pageControl
  2. 自定义 CollectionViewCell 添加 imageView 和 label
  3. 设置 CollectionView 属性显示.
  4. 监听数组的赋值progress1

makercycleview's People

Contributors

maker997 avatar

Stargazers

 avatar

Watchers

James Cloos 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.