Giter Site home page Giter Site logo

keyhan76 / scaledcentercarousel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuriy-tolstoguzov/scaledcentercarousel

0.0 0.0 0.0 1.18 MB

A carousel-based layout for UICollectionView with scaled center item.

License: MIT License

Ruby 1.06% Objective-C 87.68% Shell 11.26%

scaledcentercarousel's Introduction

ScaledCenterCarousel

codebeat badge CI Status Version License Platform

A carousel-based layout for UICollectionView with scaled center item. It contains optional paginator to force user to select single item which will be presented exaclty at center of carousel. Before using library, make sure to have a look at Example project.

alt tag

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Customization

The library is made purposely simple, but there are number of ways you can customize it. Most of properties could be set from IB via IBInspectable.

Layout

  • centerCellHeight - The height of cell at the center position.
  • centerCellWidth - The width of cell at the center position.
  • normalCellHeight - The height of cells that far enough from the center position.
  • normalCellWidth - The width of cells that far enough from the center position.
  • proposedContentOffset - The content offset that will be set once after next data source change. Think about adding items after you get them from web service and you want to pre-select one of them.

Pagination (UICollectionViewDelegate)

If you want user to be able to select only one item at a time, you probably will use built-in YTScaledCenterCarouselPaginator and set it as your UICollectionView delegate.

It has next delegate methods:

  • -carousel:didSelectElementAtIndex:
  • -carousel:didScrollToVisibleCells:

If your data source will adopt YTScaledCenterCarouselDataSource protocol. It will always know what item is selected now and can use this knowledge to add some customization to selected cells. Also it encouraged to check cell selected state, because it's updated accordingly as well.

Requirements

iOS 7+

Installation

To install it through CocoaPods, simply add the following line to your Podfile:

pod "ScaledCenterCarousel"

Run update command in your terminal:

$ pod install

Add this line to your Cartfile:

github "yuriy-tolstoguzov/ScaledCenterCarousel"

Run update command in your terminal:

$ carthage update

Author

yuriy-tolstoguzov, [email protected]

Contribution

If you want to contribute, here is couple of topics I have in mind:

  • Support for vertical layout
  • Documentation improvements
  • Swift migration

Feel free to make a pull requests or contact me if you have questions.

License

ScaledCenterCarousel is available under the MIT license. See the LICENSE file for more info.

scaledcentercarousel's People

Contributors

yuriy-tolstoguzov 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.