创建UICollectionViewFlowLayout
要设置flowLayout.minimumLineSpacing = 0.000001f;
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
flowLayout.minimumLineSpacing = 0.000001f;
//flowLayout.minimumInteritemSpacing = 20;
//flowLayout.itemSize = CGSizeMake(YCScreenWidth, YCScreenHeight);
flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
代理方法
#pragma mark <UICollectionViewDelegateFlowLayout>
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(self.bounds.size.width, self.bounds.size.height);
}
类似解决UITableView分组 组头视图默认高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 0.000001f;
}