簡體   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