Giter Site home page Giter Site logo

infinite-uicollectionview's Introduction

infinite-uicollectionview

This repository aims to provide a simple way of implementing an infinite collection view.
By infinite, we mean that as soon as a user reaches the boundary of the collection view content, the content will then loop back to the start in a circular manner.

preview

Using InfiniteCollectionView

In order to use InfiniteCollectionView:

  1. Make it the custom subclass of a UICollectionView component in your storyboard.
  2. Set the infiniteDataSource (not the standard UICollectionView dataSource) and implement the required functions.

InfiniteCollectionViewDataSource

The custom datasource is very similar to the standard UICollectionViewDataSource. There are 3 functions to implement:

func cellForItemAtIndexPath(collectionView: UICollectionView, dequeueIndexPath: NSIndexPath, usableIndexPath: NSIndexPath) -> UICollectionViewCell

This function operates exactly the same as the regular cellForItemAtIndexPath, however, you should use dequeueIndexPath for dequeuing your cell and usableIndexPath for your content.

func numberOfItems(collectionView: UICollectionView) -> Int

As with the standard UICollectionViewDatasource, simply return the number of cells of content you have.

Current Support

You can use InfiniteCollectionView to scroll infinitely in a horizontal direction with equally sized cells.

Future

Improvements will include vertical scroll support and support for various cell sizes.

infinite-uicollectionview's People

Contributors

arun-kumar0105 avatar masonlamy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

infinite-uicollectionview's Issues

Feature Request: Centre cell

When a cell reaches the middle it could snap into the middle. Also on load the cells in the middle should be aligned in the middle.

ISSUE: Unable to use infinitecollectionview class for multiple elements

It seems iโ€™m unable to set the infiniteDataSource & infiniteDelegate delegate to another control in another VC file. Is it only possible to have one delegate set to one control in the VC file. There's no error but when the app builds and run it crashes when trying to set the delegates with the collectionview.
screen shot 2015-10-30 at 15 31 15

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.