extension SavedDrawingViewController: UICollectionViewDataSource {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return drawings.collection.count
}
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
let newcell = cell as! SavedImageCell
newcell.setData(drawing: drawings.collection[indexPath.row])
newcell.deselect()
self.collectionView.deselectItem(at: indexPath, animated: false)
newcell.setSelection(selectionMode)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: sellId, for: indexPath) as! SavedImageCell
cell.invisible()
cell.deselect()
self.collectionView.deselectItem(at: indexPath, animated: false)
cell.setSelection(selectionMode)
return cell
}
}
HEre is my attempt..... line #11 was supposed to set the "visible" cells to the image and line #23 was to set the "placeholders." The functionality im going for here is to have the cells with a placeholder imageView until they are 100% in view. I can't quite accomplish this with the code I presented. Any ideas?