Created
October 31, 2014 02:39
-
-
Save jellybeansoup/3b5be4045628089afd0d to your computer and use it in GitHub Desktop.
Revisions
-
jellybeansoup created this gist
Oct 31, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #pragma mark - View life cycle - (void)viewDidLoad { [super viewDidLoad]; [_collectionView registerClass:[JSMRefreshViewCell class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"SearchViewRefresh"]; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { // If we have more results to fetch if( _resultsCount > _results.count ) { return CGSizeMake( collectionView.frame.size.width, 60 ); } // Otherwise, return zero size return CGSizeZero; } - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { // Ask for more results [self moreSearch]; // Return the cell JSMRefreshViewCell *view = (JSMRefreshViewCell *)[collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"SearchViewRefresh" forIndexPath:indexPath]; return view; }