Giter Site home page Giter Site logo

shimade / dscircularcollectionview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doddasrinivasan/dscircularcollectionview

0.0 1.0 0.0 86 KB

UICollectionView Circular Layout

License: MIT License

Ruby 4.19% Objective-C 48.02% Shell 47.79%

dscircularcollectionview's Introduction

iOS Circular Collection View Layout

Circular Collection View Layout for iOS layouts the collectionview items in a circular patterns.
You can customise the angle of the circle to be visible. Check out set up for customization


##Features

  • Universal device support (iPhone + iPad)
  • Easily stylable
  • Nice set of configuration options
  • Lightweight, simple and readable code.

##Installation

####Cocoa pods DSCircularCollectionView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "DSCircularCollectionView"

####Manual Installation

  1. Download the zip
  2. Add the files under DSCircularCollectionView into your project.

Added insert and remove animations. Download sample to check the animations.

##Setup

####Theory

####Basic

DSCircularLayout *circularLayout = [[DSCircularLayout alloc] init];
[circularLayout initWithCentre:CGPointMake(160, 160)
radius:120
itemSize:CGSizeMake(50, 50)
andAngularSpacing:20];
[circularLayout setStartAngle:M_PI endAngle:0];
circularLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
[collectionView setCollectionViewLayout:circularLayout];
  • Init the DSCircularLayout object with centre of the circle, radius of the circle, item size and spacing between each collection view cell
  • Set the visible angle in the circle with start and end angle. specify startAngle to endAndle in clock wise. (Default M_PI to 0)
  • Set the scrollDirection to UICollectionViewScrollDirectionHorizontal/Vertical (Default Vertical)

####Advanced

@property (nonatomic, assign) UICollectionViewScrollDirection scrollDirection;

@property (nonatomic, assign) BOOL mirrorX;

@property (nonatomic, assign) BOOL mirrorY;

@property (nonatomic, assign) BOOL rotateItems;

####- rotateItems (Default : NO) Enabling this to YES, will rotate items based on the angle where they are in the circle.

####- scrollDirection Based on the angle of visibility choose the scroll direction (Horizintal or Vertical). For a visibility angle between M_PI to 0 horizontal scroll works, where as for M_PI/2 to 3M_PI.2 vertical scroll works. So choose scrollDirection wisely

####- mirrorX, mirrorY (Default : NO) For a particular visibility angle(b/w start and end), it so happens that the scrolling behaves reverse. That is, the layout will scroll in the opposite direction to the user scroll. Supporting this odd begaviour would be too much of code with angles.

The best way is to find alternate visible angle and mirror it.

Reverse Scroll Proper Scroll
[circularLayout setStartAngle:2*M_PI endAngle:M_PI]; circularLayout.mirrorX = NO; circularLayout.mirrorY = NO; [circularLayout setStartAngle:M_PI endAngle:0]; circularLayout.mirrorX = NO; circularLayout.mirrorY = YES;

Example

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

Author

Dodda Srinivasan, [email protected]

License

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

dscircularcollectionview's People

Contributors

doddasrinivasan avatar

Watchers

Shimade 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.