GithubHelp home page GithubHelp logo

salubhayo-zz / mccardpickercollectionviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuhua-chen/mccardpickercollectionviewcontroller

0.0 1.0 0.0 11.74 MB

A card collection view controller inspired by Facebook People you may know.

License: MIT License

Ruby 2.91% Objective-C 97.09%

mccardpickercollectionviewcontroller's Introduction

cocoapod-badge

MCCardPickerCollectionViewController

A card collection view controller inspired by Facebook People you may know.

Take a while for screenshot :p
screen-shot

Compatibility

Required on iOS 7.

Usage

Simply drag and drop the classes under /Classes folder and use it like normal collection view controller.

To initialize the MCCardPickerCollectionViewController

MCCardPickerCollectionViewController *cardViewController = [[MCCardPickerCollectionViewController alloc] init];
	cardViewController.delegate = self;
	//Don't forget to register cell like usual collection view.
	[cardViewController.collectionView registerClass:[MCSampleCardCollectionViewCell class] forCellWithReuseIdentifier:kCellIdentifier];

and implement the delegate:

- (void)cardPickerCollectionViewController:(MCCardPickerCollectionViewController *)cardPickerCollectionViewController preparePresentingView:(UIView *)presentingView fromSelectedCell:(UICollectionViewCell *)cell
{
    //Do whatever you want to prepare for the presenting view.
}

// and collection view delegate and data source

To present view controler, we use our own method to present instead of presentViewController:animated:completion: in order to keep the transparent background.

- (void)presentInViewController:(UIViewController *)viewController;

To dismiss view controller, likewise we use our own method:

- (void)dismissFromParentViewController;

Moreover there are some properties of MCCardPickerCollectionViewFlowLayout you can adjust. If you want to change the padding of cards, you can just set minimumLineSpacing:

cardViewController.layout.minimumLineSpacing = 40;

and the bouncing velocity of centering card by setting flickVelocity:

cardViewController.layout.flickVelocity = 0.5;

The current index means the card number user picked:

NSInteger currentIndex = cardViewController.layout.currentIndex;

License

This project is under MIT License. Please feel free to use.
Michael Chen @yuhua_twit

mccardpickercollectionviewcontroller's People

Contributors

yuhua-chen 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.