要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGFloat width = self.view.bounds.size.width;
RTPagedCollectionViewLayout *layout = [[RTPagedCollectionViewLayout alloc] init];
layout.columns = 3;
layout.rows = 2;
layout.itemSize = CGSizeMake(30, 30);
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, width, 240)
collectionViewLayout:layout];
[self.view addSubview:collectionView];
}
RTPagedCollectionViewLayout 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod "RTPagedCollectionViewLayout"
Ricky Tan, [email protected]
RTPagedCollectionViewLayout 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。