UICollectionView Layout Issue

2019-02-01 15:30发布

I am using UICollectionView using the flow layout. I have made a custom UICollectionViewCell for the same. But on running the project the console keeps on throwing this error-

the behavior of the UICollectionViewFlowLayout is not defined because: the item height must be less that the height of the UICollectionView minus the section insets top and bottom values.

I have made sure that the size of the cell is correct

Has anyone been able to resolve this issue. Thanks in advance.

Regards Nitesh

13条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-01 16:33

That fixed my problem:

-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
return CGSizeMake(self.collectionView.frame.size.width, self.collectionView.frame.size.height - 70);
}

U can see padding value from top and bottom on this screen:

enter image description here

查看更多
登录 后发表回答