- [_ UIFlowLayoutSection center]:发送到实例的无法识别的选择器

时间:2017-01-05 09:01:35

标签: ios objective-c uicollectionview

如何修复此崩溃:

  

- [_ UIFlowLayoutSection center]:无法识别的选择器发送到实例。

我在做:

UICollectionViewFlowLayout *collectionLayout = [[UICollectionViewFlowLayout alloc] init];    
collectionLayout.minimumInteritemSpacing = 0.0;    
collectionLayout.minimumLineSpacing = 0.0;    
collectionLayout.sectionInset = UIEdgeInsetsMake(0.0,0.0,0.0,0.0);    
[collectionLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];    
[_collectionView setCollectionViewLayout:collectionLayout];

1 个答案:

答案 0 :(得分:5)

尝试在设置其布局之前重新加载collectionView。

我遇到了同样的问题,并通过在设置flowlayout之前重新加载collectionView来解决。