Skip to content

Instantly share code, notes, and snippets.

@keicoder
Created February 26, 2014 03:36
Show Gist options
  • Save keicoder/9223093 to your computer and use it in GitHub Desktop.
Save keicoder/9223093 to your computer and use it in GitHub Desktop.
objective-c : basic UICollectionView
//basic UICollectionView
//TWPhotosCollectionViewController.h
@interface TWPhotosCollectionViewController : UICollectionViewController
@end
//TWPhotosCollectionViewController.m
@implementation TWPhotosCollectionViewController
#pragma mark - UICollectionView 데이터 소스
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));}
static NSString *CellIdentifier = @"Photo Cell";
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier
forIndexPath:indexPath];
cell.backgroundColor = [UIColor whiteColor];
return cell;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));}
return 5;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment