参考资料
[UICollectionView详解][9]
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {return CGSizeMake(100, 100);}
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
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.
直接在Podfile中加入FDStackView,即可以无缝使用StackView及其N多的功能。
[9]: http://www.cnblogs.com/ios8/p/iOS-UICollectionView.html