您的位置:首页 > 产品设计 > UI/UE

UICollectionViewCell的设置间距

2016-08-05 15:54 387 查看

UICollectionViewCell的设置间距

#pragma mark - UICollectionView 大小(宽高,平均一行三个)

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{

CGFloat width = ([UIScreen mainScreen].bounds.size.width ) / 3;

return CGSizeMake(width, width);

}

// 设置间距,不设置默认间距比较大,导致一行放不了三个cell

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{

return 0;

}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: