由于内部问题已删除。
Have you try this. Change your sizeForItemAtIndexPath
function with my one.
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row%3==0) {
return CGSizeMake(self.collectionView.frame.size.width, 80);
}
CGFloat minSpace = 10; //Set this minSpace for space that you want between two cell
return CGSizeMake((self.collectionView.frame.size.width - minSpace)/2, 80);
}
Also change your cellForItemAtIndexPath
if condition with this if condition to return two different cell. If you have.
Hope this will help you.
Your target cell index order order are 0 , 1,2 , 3 , 4,5 6 , 7,8 9 ,...... Your order for identification is 0,3,6,9... code for size for item at indexpath should be
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger pos = indexPath.row;
if(pos%3==0)
{
return CGSizeMake(dynamicCollection.frame.size.width-10, 80);
}
else
{
return CGSizeMake(dynamicCollection.frame.size.width/2-10, 80);
}
}
In your story board provide inset for sections 5,5,5,5 . Select the collectionview and in scale attribute.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.