TableGrid

UICollectionView

参考资料

UICollectionViewCell:自定义样式

Auto Size

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(100, 100);
}

UIStackView

  1. UICollectionView is like a grid, UIStackView is only for 1 dimension: vertical or horizontal.

UICollectionView is like UITableView, but it supports more than single-column layouts.

Collection views provide the same general function as table views except that a collection view is able to support more than just single-column layouts. Collection views support customizable layouts that can be used to implement multi-column grids, tiled layouts, circular layouts, and many more. You can even change the layout of a collection view dynamically if you want.

vs

The UIStackView class provides a streamlined interface for laying out a collection of views in either a column or a row

  1. For me, With StackView, you benefit the “AutoLayout” feature, for example: you put 4 views in the Stack, this component will decide how those views will be presented on the screen, depending on their size.

UIStackView-Extension

FDStackView

直接在 Podfile 中加入 FDStackView,即可以无缝使用 StackView 及其 N 多的功能。

CardView

Koloda

Preview

下一页