繁体   English   中英

从可重用的Cell中出列时,自定义CollectionViewCell会触发什么方法?

[英]What method is triggered on a custom CollectionViewCell when dequeued from a reusable Cell?

我像往常一样使用其父ViewController中的方法将可重用的自定义ItemCollectionViewCell出列

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    ItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
}

但是在我的ItemCollectionViewCell我实现了initWithFrame方法,该方法最初只是被调用,但是当一个单元格被重新出现以便重复使用时。

在父视图控制器上调用[collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath]之后,在重新添加到队列之前,在ItemCollectionView内触发的方法是什么?

-[UICollectionReusableView prepareForReuse]是方法。 是该方法的文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM