我正在使用集合視圖,我在集合視圖中顯示了一系列圖像,現在我需要以更大的尺寸在另一個視圖中顯示選定的圖像。所以我執行如下。實現單個單元格選擇以調出詳細視圖
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