Created
January 3, 2014 14:00
-
-
Save dreampowder/8238279 to your computer and use it in GitHub Desktop.
Copy-Paste Ready UICollectionView Datasources and Delegates for quick view creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - UICollectionView Datasource | |
// 1 | |
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section { | |
return 1; | |
} | |
// 2 | |
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView { | |
return 1; | |
} | |
// 3 | |
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
UICollectionViewCell* cell = (UICollectionViewCell*)[cv dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; | |
return cell; | |
} | |
// 4 | |
- (UICollectionReusableView *)collectionView: | |
(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath | |
{ | |
// | |
} | |
#pragma mark - UICollectionViewDelegate | |
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
} | |
- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath { | |
// TODO: Deselect item | |
} | |
- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{ | |
} | |
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment