我正在使用集合视图,我在集合视图中显示了一系列图像,现在我需要以更大的尺寸在另一个视图中显示选定的图像。所以我执行如下。实现单个单元格选择以调出详细视图
FUNC的CollectionView(的CollectionView:UICollectionView,numberOfItemsInSection部的:int) - >内部{
return logoImage.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell : PhotoCollection = collectionView.dequeueReusableCellWithReuseIdentifier("PhotoCells", forIndexPath: indexPath) as PhotoCollection
cell.imageView.image = logoImage[indexPath.row]
return cell
}
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
var newCell :PhotoCollection = collectionView.cellForItemAtIndexPath(indexPath) as PhotoCollection
var fullImageVw : FullImageClass = self.storyboard?.instantiateViewControllerWithIdentifier("FullImage") as FullImageClass
fullImageVw.imageFull.image = newCell.imageView.image
self.navigationController?.pushViewController(fullImageVw, animated: true)
}
但是我得到出乎意料地发现零,而在解缠线的可选值fullImageVw.imageFull.image = newCell错误.imageView.image。 但newCell.imageView.image有一个值,我仍然不知道为什么面临这个错误。 任何人都可以帮助我解决这个错误。
我它。谢谢!!! – 2014-12-04 20:12:19