Answer the question
In order to leave comments, you need to log in
Why do images jump from cell to cell in CollectionView?
Happy Friday everyone!
I continue my studies of swift. Faced with an incomprehensible situation that pictures are displayed in the CollectionView, and so these pictures are replaced by others when loading, then they are replaced by the necessary ones. When scrolling, cells with previously loaded pictures are also created. And in the same order in which they were created earlier. Those. just duplicates 1, 2, 3, etc. Moreover, such a trick is repeated if you scroll up, then back down. When you continue scrolling (recreating the cell), the process of loading the picture starts and the necessary pictures are inserted.
here is what i do:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! PhotoListCollectionViewCell
let filename = "http://site.ru/img.jpg"
let URL = NSURL(string: filename)!
cell.image.af_setImageWithURL(URL)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question