UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
layout.minimumInteritemSpacing = 19;
// layout.minimumLineSpacing = 50;
//设置item大小为屏幕大小
layout.itemSize=CGSizeMake(52,68);
//设置水平滚动
layout.scrollDirection = UICollectionViewScrollDirectionVertical;//水平方向
// layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; //垂直方向
// 当UICollectionView设置为横向的话minimumLineSpacing是列间距
// 当UICollectionView设置为纵向的话minimumInteritemSpacing是列间距
UICollectionView *collection = [[UICollectionView alloc]initWithFrame:CGRectMake(16, 50, SCREEN_WIDTH-32, 70) collectionViewLayout:layout];
collection.delegate=self;
collection.dataSource=self;
collection.backgroundColor= [UIColorwhiteColor];
collection.showsHorizontalScrollIndicator = false;
[examineViewaddSubview:collection];
[collectionregisterClass:[LCExamineCell class] forCellWithReuseIdentifier:@"LCExamineCell"];
#pragma mark - collectionView协议方法
- (NSInteger)collectionView:(UICollectionView*)collectionViewnumberOfItemsInSection:(NSInteger)section {
return6;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
LCExamineCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"LCExamineCell" forIndexPath:indexPath];
returncell;
}
网友评论