Ios6 layoutAttributesForItemAtIndexPath-何时调用?

Ios6 layoutAttributesForItemAtIndexPath-何时调用?,ios6,uicollectionview,Ios6,Uicollectionview,我目前正在玩一些新UICollectionView的演示项目。 大多数演示都覆盖了这些子类中的layouttributesforItemAtIndexPath。但在该示例中,从未调用过该方法 从Apple文档中,我知道我必须覆盖layouttributesforitematindexpath 我无法确定在哪种情况下调用此方法 此方法仅适用于特殊情况吗?也许您可以在Apple doc中找到,子类必须覆盖LayoutAttributesForElementsRect和layoutAttributes

我目前正在玩一些新UICollectionView的演示项目。 大多数演示都覆盖了这些子类中的
layouttributesforItemAtIndexPath
。但在该示例中,从未调用过该方法

从Apple文档中,我知道我必须覆盖
layouttributesforitematindexpath

我无法确定在哪种情况下调用此方法


此方法仅适用于特殊情况吗?

也许您可以在Apple doc中找到,子类必须覆盖LayoutAttributesForElementsRect和layoutAttributesForItemAtIndexPath 请阅读以下内容:

    layoutAttributesForElementsInRect:

    Returns the layout attributes for all of the cells and views in the specified rectangle.
    - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
    Parameters

    rect

        The rectangle (specified in the collection view’s coordinate system) containing the target views.

    Return Value

    An array of UICollectionViewLayoutAttributes objects representing the layout information for the cells and views. The default implementation returns nil.
    Discussion

    Subclasses must override this method and use it to return layout information for all items whose view intersects the specified rectangle. Your implementation should return attributes for all visual elements, including cells, supplementary views, and decoration views.

    When creating the layout attributes, always create an attributes object that represents the correct element type (cell, supplementary, or decoration). The collection view differentiates between attributes for each type and uses that information to make decisions about which views to create and how to manage them.
    Availability

        Available in iOS 6.0 and later.

    Declared In
    UICollectionViewLayout.h

我猜在给定的位置插入或删除项时会调用它?