【发布时间】:2013-09-25 16:25:50
【问题描述】:
我想展示一个 UICollectionView,它正好包含 2 行,每行 100 个单元格。
// 1
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section {
return 100;
}
// 2
- (NSInteger)numberOfSectionsInCollectionView: (UICollectionView *)collectionView {
return 2;
}
// 3
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath {
MyCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
cell.lbl.text = @"Data";
return cell;
}
我得到了这个:
如何为 UICollectionView 指定行号?我想创建一个 2x100 的表。
【问题讨论】:
标签: ios uicollectionview uicollectionviewcell