CPYGridPagingLayout 是一个 UICollectionViewLayout 子类,用于以网格的形式显示项目。
CPYGridPagingLayout *layout = [[CPYGridPagingLayout alloc] init];
layout.numberOfColum = 5;
layout.numberOfLine = 3;
layout.itemSpacing = 10;
layout.lineSpacing = 10;
layout.direction = CPYGridPagingLayoutDirectionVertical;
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
collectionView.dataSource = self;
collectionView.delegate = self;
[self.view addSubview:collectionView];
// you can use autolayout to layout the collection view here
// and then you can change the layout's custom options if you need
CPYGridPagingLayout 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "CPYGridPagingLayout"
然后按照官方指南配置您的项目。
Cielpy, [email protected]
CPYGridPagingLayout 使用 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。