UICollectionViewFlowLayout & UICollectionViewDelegateFlowLayout

A concrete layout object that organizes items into a grid with optional header and footer views for each section. 

The items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row comprising as many cells as will fit. Cells can be the same sizes or different sizes.

A flow layout works with the collection view’s delegate object to determine the size of items, headers, and footers in each section and grid. That delegate object must conform to the UICollectionViewDelegateFlowLayoutprotocol. Use of the delegate allows you to adjust layout information dynamically. For example, you would need to use a delegate object to specify different sizes for items in the grid. If you do not provide a delegate, the flow layout uses the default values you set using the properties of this class.

 

动态定制视图尺寸的方案有两个:

1、delegate;

2、子类化;

posted @ 2018-07-17 17:39  zzfx  阅读(571)  评论(0编辑  收藏  举报