У меня есть то, что кажется успешно проанализированным ссылками изображения AS3 на массив UIImage с именем «smImg».
Теперь я пытаюсь добавить каждую ссылку в качестве UIImage к моему UICollectionViewCell imageView (где я добавил IBOutlet «imageView».) Я продолжаю получать сообщение об ошибке «UICollectionViewCell» не имеет члена с именем «imageView». Соответствующий код ниже.
ViewModel.swift:
func imageForItemAtIndexPath(indexPath: NSIndexPath) -> UIImage {
return smImg[indexPath.row]
}
ViewController.swift
func configureCell(cell: UICollectionViewCell, atIndexPath indexPath: NSIndexPath) {
cell.imageView!.image = viewModel.imageForItemAtIndexPath(indexPath) //Error occurs here
}
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as PhotoCell
configureCell(cell, atIndexPath: indexPath)
return cell
}
PhotoCell.swift
class PhotoCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
}
Может кто-нибудь, пожалуйста, помогите мне исправить это? Любая помощь очень ценится, я стараюсь не задавать здесь слишком много вопросов, но не смог найти решение самостоятельно.