Answer the question
In order to leave comments, you need to log in
Why are cells in UICollectionView changing?
I have a UICollectionView whose cells are configured based on data received from the web.
Here is the cellForItemAt method:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
print(indexPath.row)
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "searchingCell", for: indexPath) as! SearchingCollectionViewCell
cell.configure(stringUrl: images[indexPath.row].fullUrl)
return cell
}
Answer the question
In order to leave comments, you need to log in
Rethink your approach to filling cells with content. Those. or
- at the time of filling, the content should already be, and it is enough just to place it in the cell;
or
- (if the first option is not possible) fill the cell with "empty" content, and in parallel load the content asynchronously, but stop loading the content if the cell is out of the visible range.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question