CollectionViewLayoutAttributes
public class CollectionViewLayoutAttributes : CustomStringConvertible
An UICollectionViewLayoutAttributes object manages the layout-related attributes for a given item in a collection view. Layout objects create instances of this class when asked to do so by the collection view. In turn, the collection view uses the layout information to position cells and supplementary views inside its bounds.
-
The index path of the item in the collection view.
Declaration
Swift
public let indexPath: IndexPath
-
The type of the item.
Declaration
Swift
public let representedElementCategory: CollectionElementCategory
-
The layout-specific identifier for the target view.
Declaration
Swift
public let representedElementKind: String?
-
The frame rectangle of the item.
Declaration
Swift
public var frame: CGRect
-
The center point of the item.
Declaration
Swift
public var center: CGPoint { get set }
-
The size of the item
Declaration
Swift
public var size: CGSize { get set }
-
The bounds of the item
Declaration
Swift
public var bounds: CGRect { get set }
-
The transparency of the item.
Declaration
Swift
public var alpha: CGFloat
-
Specifies the item’s position on the z axis.
Declaration
Swift
public var zIndex: CGFloat
-
Determines whether the item is currently displayed.
Declaration
Swift
public var hidden: Bool
-
Specifies if the item it detached from the scroll view (SupplementaryViews only)
Declaration
Swift
public var floating: Bool
-
Creates and returns a layout attributes object that represents a cell with the specified index path.
Declaration
Swift
public init(forCellWith indexPath: IndexPath)
Parameters
indexPath
The index path of the cell.
-
Creates and returns a layout attributes object that represents the specified supplementary view.
Declaration
Swift
public init(forSupplementaryViewOfKind elementKind: String, with indexPath: IndexPath)
Parameters
elementKind
A string that identifies the type of supplementary view.
indexPath
The index path of the view.
-
Declaration
Swift
public var description: String { get }
-
Create a copy of the layout attributes
Note
A CollectionViewLayout should copy attributes when returning them
Declaration
Swift
public func copy() -> CollectionViewLayoutAttributes
Return Value
An initialized object with the same attributes