輕松處理UICollectionView流式布局的框架Blueprints,它配備了兩個內(nèi)置布局Vertical layout和Horizontal layout。
Vertical layout示例代碼:
let blueprintLayout = VerticalBlueprintLayout(
itemsPerRow: 1.0,
itemSize: CGSize(width: 200, height: 60),
minimumInteritemSpacing: 10,
minimumLineSpacing: 10,
sectionInset: EdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
stickyHeaders: true,
stickyFooters: false
)
let collectionView = UICollectionView(frame: .zero,
collectionViewLayout: blueprintLayout)
Horizontal layout示例代碼:
let blueprintLayout = HorizontalBlueprintLayout(
itemsPerRow: 1.0,
itemsPerColumn: 2,
itemSize: CGSize(width: 200, height: 200),
minimumInteritemSpacing: 10,
minimumLineSpacing: 10,
sectionInset: EdgeInsets(top: 10, left: 10, bottom: 10, right: 10),
stickyHeaders: true,
stickyFooters: true
)
let collectionView = UICollectionView(frame: .zero,
collectionViewLayout: blueprintLayout)