Created
December 14, 2014 13:43
-
-
Save yuxiangq/0c5aa8c4dd9ebc97047a to your computer and use it in GitHub Desktop.
UICollectionViewDataSource的回调方法
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
//返回有多少个Section,该方法和UITableView的一样 | |
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ | |
return 1; | |
} | |
//返回每个Section有多少rows | |
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ | |
return 1; | |
} | |
//返回cell | |
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ | |
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:kCollectionCellIdentifier forIndexPath:indexPath]; | |
cell.contentView.backgroundColor=[UIColor whiteColor]; | |
return cell; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment