Tell me pls how to change cell's backGroundColor
from imagePickerController func:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
self.dismiss(animated: true, completion: nil)
//let imageUser = info[UIImagePickerController.InfoKey.editedImage] as! UIImage
let indexPath = IndexPath(item: 0, section: 0)
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellRegisterMarket", for: indexPath) as! cellRegisterMarket
cell.backgroundColor = .red
}
Replace this
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellRegisterMarket", for: indexPath) as! cellRegisterMarket
with
let cell = collectionView.cellForItem(at:indexPath) as! cellRegisterMarket
BTW this isn't a good way , update the model and reload the collection