Ios JSON数据在detailViewController中返回空单元格?

Ios JSON数据在detailViewController中返回空单元格?,ios,swift,uicollectionviewcell,Ios,Swift,Uicollectionviewcell,我有一个collectionViewCell(动态),在tableview中有图像和标签(从JSON加载)。我想要的是,如果我单击任何单元格(包含图像/文件夹),它应该显示detailedViewController及其内容(也来自JSON)。 我的mainViewController工作正常。显示数据 在mainViewController内部我使用了didSelectItemAtIndexPath如下 func collectionView(collectionView: UICollect

我有一个collectionViewCell(动态),在tableview中有图像和标签(从
JSON
加载)。我想要的是,如果我单击任何单元格(包含图像/文件夹),它应该显示detailedViewController及其内容(也来自
JSON
)。 我的mainViewController工作正常。显示数据

mainViewController内部我使用了didSelectItemAtIndexPath如下

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
   println("USER TAPPED item# \(indexPath.item)")
   let subFolderView:SubFolderViewController = self.storyboard?.instantiateViewControllerWithIdentifier("subFolder") as! SubFolderViewController
   self.navigationController?.pushViewController(subFolderView, animated: true)
   subFolderView.imageSelected = self.Data[indexPath.row].AbsolutePath
   subFolderView.imageSelected = self.Data[indexPath.row].Name
   subFolderView.imageSelected = self.Data[indexPath.row].Description
但单击时返回空视图

在我的第二视图控制器中我有

var imageSelected:String!

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    var cell:SubFolderCollectionViewCell? = collectionView.dequeueReusableCellWithReuseIdentifier("CollectionViewCell", forIndexPath: indexPath) as? SubFolderCollectionViewCell
    cell?.subFolderDescription.text = self.Data[indexPath.row].Description
    cell?.subFolderName.text = self.Data[indexPath.row].Name

    let picUrl = self.Data[indexPath.row].AbsolutePath
    let url = NSURL(string: picUrl)
    if(url != nil) {  
        let data = NSData(contentsOfURL : url!)
        if(data != nil) {
            cell?.subImage?.image = UIImage(data: data!)
        }
    }
    return cell!
}
请任何人指导我继续前进……我是iOS开发新手,更喜欢swift

在mystoryBoadrd中,两个视图控制器都包含

查看

表格视图

表格视图单元格

内容视图

收藏视图

集合视图单元格

在该图像视图中标签显示数据

感谢您的帮助, 如果您需要更多代码,请告诉我………

检查您的代码

您使用didSelectItemAtIndexPath而不是didSelectItemAtIndexPath方法


这是不同的tableview委托方法。更改此项并让我知道是否存在任何问题。

子文件夹视图。imageSelected是什么?我觉得json不是相关标记。@anhtu subFolder.imageSelected这些是我的json响应数据为什么编辑了3次:
subFolderView.imageSelected=self.Data[indexath.row]。AbsolutePath subFolderView.imageSelected=self.Data[indexPath.row].Name subFolderView.imageSelected=self.Data[indexPath.row].Description
?以及为什么使用
didDecelectItemAtIndexPath
?我也使用了didSelectItemIndexath..没有用..请提供带有侧栏的布局屏幕截图以了解更多规范。