自定义layout

解决方案 »

  1.   

    首先使用UICollecitionVIewDelegateFlowLayout代理方法设置layout
    在-(CGSize)CollectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForIteAtIndexPath:(NSIndexPatch)indexPath{}中根据分段控件的selectedSegmentIndex判断设置相应的itemSize然后再分段空间的点击事件中创建一个新的UICollectionViewFlowLayout对象
    再使用UICollectionView对象调用方法setCollectionViewLayout:新的layout对象 animated:YES
    这样就可以的
    我也有代码,你需要的话我发给你