0413--iOS之UICollectionReusableView类

发布于:2021-10-16 19:50:03

Class


UICollectionReusableView

A view that defines the behavior for all cells and supplementary views presented by a collection view.


?????? --一个定义collection view所呈现的所有的cell和补充视图的行为的视图


????? UICollectionViewCell 继承于该 UICollectionReusableView


?


Declaration

class UICollectionReusableView : UIView

Overview?????????????????????? --概览

Reusable views are so named because the collection view places them on a reuse queue rather than deleting them when they are scrolled out of the visible bounds. Such a view can then be retrieved and repurposed for a different set of content.


???????? --可重用视图之所以如此命名,是因为集合视图将它们放置在重用队列中,而不是在它们滚动出可见边界时将其删除。然后,在显示不同的内容集时,可以再获取Reusable views并重新调整其用途。


?


Subclassing Notes???????????? --子类化建议

This class is intended to be subclassed. Most methods defined by this class have minimal or no implementations. You are not required to override any of the methods but can do so in cases where you want to respond to changes in the view’s usage or layout.


?????????? --这个类的意图就是用来被子类化的。这个类定义的大多数方法都有最小的实现或没有实现。您不需要重写任何方法但可以在需要响应视图的用法或布局变化的情况下这样做


?


Topics?????????????????????? --专题
Reusing Cells????????????????????????? --重用cell

var reuseIdentifier: String?


A string that identifies the purpose of the view.


func prepareForReuse()


Performs any clean up necessary to prepare the view for use again.


?


Managing Layout Changes????????????????????????? --管理布局的变化(注意该类的意图是为了子类化)

func preferredLayoutAttributesFitting(UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes


Gives the cell a chance to modify the attributes provided by the layout object.


?????? --该方法可用于修改layout object提供的布局属性,子类可复写


func apply(UICollectionViewLayoutAttributes)


Applies the specified layout attributes to the view.


????????????? --应用指定的布局特征到该view上,子类可复写


func willTransition(from: UICollectionViewLayout, to: UICollectionViewLayout)


Tells your view that the layout object of the collection view is about to change.


???????????? --collection view的layout将要发生改变时,该方法会被自动调用,子类可复写


func didTransition(from: UICollectionViewLayout, to: UICollectionViewLayout)


Tells your view that the layout object of the collection view changed.


?????????? --collection view的layout已经发生改变时,该方法会被自动调用,子类可复写


?


Relationships??????????????????? --继承关系
Inherits From

UIView


Conforms To

CVarArg

Equatable

Hashable

NSTouchBarProvider

UIAccessibilityIdentification

UILargeContentViewerItem

UIPasteConfigurationSupporting

UIUserActivityRestoring


See Also
Cells

class UICollectionViewCell


A single data item when that item is within the collection view’s visible bounds.

相关推荐

最新更新

猜你喜欢