Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuhua-chen/MCCardPickerCollectionViewController
A card collection view controller inspired by Facebook People you may know.
https://github.com/yuhua-chen/MCCardPickerCollectionViewController
Last synced: about 1 month ago
JSON representation
A card collection view controller inspired by Facebook People you may know.
- Host: GitHub
- URL: https://github.com/yuhua-chen/MCCardPickerCollectionViewController
- Owner: yuhua-chen
- License: mit
- Created: 2015-03-04T04:19:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-09T09:31:09.000Z (over 9 years ago)
- Last Synced: 2024-07-26T00:53:31.638Z (about 2 months ago)
- Language: Objective-C
- Size: 11.5 MB
- Stars: 228
- Watchers: 13
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![cocoapod-badge](https://cocoapod-badges.herokuapp.com/v/MCCardPickerCollectionViewController/badge.png)
# MCCardPickerCollectionViewControllerA card collection view controller inspired by Facebook People you may know.
Take a while for screenshot :p
![screen-shot](https://raw.githubusercontent.com/yuhua-chen/MCCardPickerCollectionViewController/master/demo.gif)# 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`
```objc
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:
```objc
- (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.
```objc
- (void)presentInViewController:(UIViewController *)viewController;
```To dismiss view controller, likewise we use our own method:
```objc
- (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`:
```objc
cardViewController.layout.minimumLineSpacing = 40;
```and the bouncing velocity of centering card by setting `flickVelocity`:
```objc
cardViewController.layout.flickVelocity = 0.5;
```The current index means the card number user picked:
```objc
NSInteger currentIndex = cardViewController.layout.currentIndex;
```License
============================
This project is under MIT License. Please feel free to use.
Michael Chen [@yuhua_twit](https://twitter.com/yuhua_twit)