要删除collectionView单元格下面的空间:

UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setItemSize:CGSizeMake(300, 435)];
[flowLayout setMinimumInteritemSpacing:0.0f];
[flowLayout setMinimumLineSpacing:20.0f];
[flowLayout setSectionInset:UIEdgeInsetsMake(0, 10, 0, 10)];

[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];

[self.collectionView setCollectionViewLayout:flowLayout];

最佳答案

尝试在-viewDidLoad中添加它:

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;

关于ios - UICollectionView,导航栏覆盖了单元格,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27017767/

10-10 20:49