Use collectionView:nodeBlockForItemAtIndexPath: in all examples

This commit is contained in:
Michael Schneider
2016-02-24 20:17:18 -08:00
parent f948a807c9
commit 8418d8be24
5 changed files with 31 additions and 20 deletions

View File

@@ -90,14 +90,18 @@ static NSUInteger kNumberOfImages = 14;
#pragma mark -
#pragma mark ASCollectionView data source.
- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForItemAtIndexPath:(NSIndexPath *)indexPath
- (ASCellNodeBlock)collectionView:(ASCollectionView *)collectionView nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [[ImageCellNode alloc] initWithImage:_sections[indexPath.section][indexPath.item]];
UIImage *image = _sections[indexPath.section][indexPath.item];
return ^{
return [[ImageCellNode alloc] initWithImage:image];
};
}
- (ASCellNode *)collectionView:(ASCollectionView *)collectionView nodeForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
NSString *text = [NSString stringWithFormat:@"Section %d", (int)indexPath.section + 1];
NSString *text = [NSString stringWithFormat:@"Section %zd", indexPath.section + 1];
return [[SupplementaryNode alloc] initWithText:text];
}