我正在尝试使用Collection View实现这种效果:
这些单元格的宽度应自动调整为屏幕的宽度。每个像元的高度应为45%(10%用于此黑色间隙)。我尝试了很多组合,但无法以任何方式实现。在此先感谢您的帮助。最好的问候,阿德里安。
将collectionView宽度设置为全屏。实现这些委托方法
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return CGSizeMake(collectionView.bounds.size.width, height);
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
return UIEdgeInsetsMake(0, 0, bottom, 0);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句