Created
August 12, 2014 06:16
-
-
Save yoshyosh/5538e6bd1ac291406f57 to your computer and use it in GitHub Desktop.
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
// | |
// ViewController.m | |
// collection | |
// | |
// Created by Joseph Anderson on 8/11/14. | |
// Copyright (c) 2014 ifd. All rights reserved. | |
// | |
#import "ViewController.h" | |
#import "PhotoLibraryCell.h" | |
@interface ViewController () <UICollectionViewDelegate, UICollectionViewDataSource> | |
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView; | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
self.collectionView.dataSource = self; | |
self.collectionView.delegate = self; | |
[self.collectionView registerNib:[UINib nibWithNibName:@"PhotoLibraryCell" bundle:nil] forCellWithReuseIdentifier:@"cell"]; | |
UICollectionViewFlowLayout *flowLayout = (UICollectionViewFlowLayout *)self.collectionView.collectionViewLayout; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { | |
return 1; | |
} | |
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { | |
return 20; | |
} | |
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { | |
PhotoLibraryCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath]; | |
cell.idLabel.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row]; | |
return cell; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment