Created
March 22, 2014 19:32
-
-
Save alltom/9712991 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@implementation VP2CollectionViewLayout | |
#pragma mark - Called during the layout process | |
// step 1 | |
- (void)prepareLayout | |
{ | |
// if it's not too much data, create all element attributes here | |
} | |
// step 2 | |
- (CGSize)collectionViewContentSize | |
{ | |
return CGSizeZero; | |
} | |
// step 3 | |
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect | |
{ | |
// at a minimum, each attribute should have size and position | |
// set zIndex if they overlap | |
// you can subclass UICollectionViewLayoutAttributes if you need to | |
return @[]; | |
} | |
#pragma mark - Other | |
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
// cannot modify attributes here | |
return nil; | |
} | |
// use for headers and footers | |
// the elements come from the data source | |
- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath | |
{ | |
return nil; | |
} | |
#pragma mark - For insertion/deletion animation | |
- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath | |
{ | |
return nil; | |
} | |
- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath | |
{ | |
return nil; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment