CollectionViewDelegateSlantedLayout

@objc
public protocol CollectionViewDelegateSlantedLayout : UICollectionViewDelegate

The CollectionViewDelegateSlantedLayout protocol defines methods that let you coordinate with a CollectionViewSlantedLayout object to implement a slanted layout. The methods of this protocol define the size of items.

  • Asks the delegate for the size of the specified item’s cell.

    If you do not implement this method, the slanted layout uses the values in its itemSize property to set the size of items instead. Your implementation of this method can return a fixed set of sizes or dynamically adjust the sizes based on the cell’s content.

    Declaration

    Swift

    @objc
    optional func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: CollectionViewSlantedLayout, sizeForItemAt indexPath: IndexPath) -> CGFloat

    Parameters

    collectionView

    The collection view object displaying the slanted layout.

    collectionViewLayout

    The layout object requesting the information.

    indexPath

    The index path of the item.

    Return Value

    The height of the specified item (or it’s width for vertical scrolling direction). The value must be greater than 0.