A layout object that organizes items into a grid with optional header and footer views for each section.
Declaration
class UICollectionViewFlowLayout : UICollectionViewLayout
Overview
A flow layout is a type of collection view layout. Items in the collection view flow from one row or column (depending on the scrolling direction) to the next, with each row containing 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 UICollectionViewDelegateFlowLayout protocol. Use of the delegate allows you to adjust layout information dynamically. For example, you use a delegate object to specify different sizes for items in the grid. If you don’t provide a delegate, the flow layout uses the default values you set in the properties of this class.
Flow layouts lay out their content using a fixed distance in one direction and a scrollable distance in the other. For example, in a vertically scrolling grid, the width of the grid content is constrained to the width of the corresponding collection view while the height of the content adjusts dynamically to match the number of sections and items in the grid. The layout scrolls vertically by default, but you can configure the scrolling direction using the scrollDirection property.
Each section in a flow layout can have its own custom header and footer. To configure the header or footer for a view, configure the size of the header or footer to be non-zero. Implement the appropriate delegate methods or assign appropriate values to the headerReferenceSize and footerReferenceSize properties. If the header or footer size is 0, the corresponding view isn’t added to the collection view.
developer.apple.com/documentation/uikit/uicollectionviewflowlayout
Apple Developer Documentation
developer.apple.com
'Programming > Swift' 카테고리의 다른 글
Class: UIPickerView (0) | 2020.10.30 |
---|---|
Class: URLSession (0) | 2020.10.29 |
UITableViewDelegate (0) | 2020.10.29 |
Human Interface Guidelines: Modality (0) | 2020.10.26 |
Human Interface Guidelines: Navigation (0) | 2020.10.26 |