iOS UICollectionView學習之一,UICollectionView + storyboard 簡單應用
阿新 • • 發佈:2019-02-20
#import "ViewController.h"
#import "myCollectionViewCell.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark ---UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 20;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identify = @"myCell";
myCollectionViewCell *cell = (myCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identify forIndexPath:indexPath];
cell.titleImageV.image = [UIImage imageNamed:@"LOGO80-80"];
cell.titleLable.text = [NSString stringWithFormat:@"{%ld,%ld}",indexPath.section,indexPath.row];
return cell;
}
#import "myCollectionViewCell.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
#pragma mark ---UICollectionView DataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 20;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *identify = @"myCell";
myCollectionViewCell *cell = (myCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:identify forIndexPath:indexPath];
cell.titleImageV.image = [UIImage imageNamed:@"LOGO80-80"];
cell.titleLable.text = [NSString stringWithFormat:@"{%ld,%ld}",indexPath.section,indexPath.row];
return cell;
}