【发布时间】:2015-02-12 01:51:41
【问题描述】:
我正在尝试将数组中的图像资产分配到集合视图中。我正在努力解决一条线。有人对我做错了什么有建议吗?问题出在单元格项目上。我的代码是:
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
var cell = collectionView.dequeueReusableCellWithReuseIdentifier("MyCell", forIndexPath: indexPath) as CollectionViewCell
println("just seeing when this prints")
println(self.matchedSelfie)
cell.match.image = self.matchedSelfie
return cell
问题在于 cell.match.image = self.matchedSelfie
【问题讨论】:
-
有什么问题?如果单元格为 nil,则应创建一个新的 CollectionViewCell 实例。 self.matchedSelfie 中有图片吗?
-
matchedSelfie 数组中存储了 9 张图像。我不知道如何将它们分配为匹配项。
标签: arrays image swift uicollectionview