由于以下两个错误,我的构建失败
我无法弄清楚导致失败的变化或如何在不重做整个项目的情况下修复它。
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cellApt = collectionView.dequeueReusableCellWithReuseIdentifier("cellApt", forIndexPath: indexPath) as! ExploreCollectionViewCell
cellApt.imageView?.image = self.imageArray[indexPath.row]
cellApt.titleLabel?.text = self.condoCells[indexPath.row]
cellApt.setNeedsLayout()
return cellApt
}
答案 0 :(得分:0)
替换:
let cellApt = collectionView.dequeueReusableCellWithReuseIdentifier("cellApt", forIndexPath: indexPath) as! ExploreCollectionViewCell
使用:
let cellApt: ExploreCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("cellApt", forIndexPath: indexPath) as! ExploreCollectionViewCell
答案 1 :(得分:0)
ExploreCollectionViewCell应具有以下代码之类的属性:
class ExploreCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
...
}