1)我怎样才能实现如图所示UICollectionView
?
2)我已经尝试过-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
方法并传递了不同的大小,但它在单元格之间留下了空格。我可以清空这些空间吗?我想要每个单元格都有不同的高度和宽度
Current output:
.
抱歉,这已经太晚了......但这也许会对尚未找到答案的人有所帮助。
如果您的图像位于数组中,您可以简单地引用图像大小并从那里调整单元格大小:
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
UIImage *image = [imageArray objectAtIndex:indexPath.row];
//You may want to create a divider to scale the size by the way..
return CGSizeMake(image.size.width, image.size.height);
}
希望这可以帮助..
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)