在GridView中添加自定义视图

问题描述

我有一个自定义的gridview。我想在用户单击下拉按钮然后隐藏视图时,在下面的单元格中添加仅包含单个UILable的自定义视图。我试图搜索出但没有找到适合GridView的任何解决方案。图片显示的红线不只是要在其中添加视图,还可以将视图添加到任何单元格中。

GridView函数显示单元格中的数据:

func gridView(_ gridView: IGGridView,cellAt path: IGCellPath) -> IGGridViewCell{
   var cell    : IGGridViewCell?
   switch(path.columnIndex) {
            
        ......

        case 1:
            cell = bindInstituteCell(gridView,path: path,data: pipelinesummaryDetail)
        
        ......
    }

}

func bindInstituteCell(_ grid: IGGridView,path: IGCellPath,data: ExternalRelationReportDC) ->IGGridViewCell {
    
    var cell = grid.dequeueReusableCell(withIdentifier: "InstituteCell") as? ExternalRelationDefaultGridCell
    
    if cell == nil {
        
        cell = ExternalRelationDefaultGridCell(reuseIdentifier: "InstituteCell")
    }
    cell?.lblFieldName.text = data.INSTITUTION_NAME
    
    
    return cell!
}

ExternalRelationDefaultGridCell是一个为单元格创建视图的类。

帮助感激。谢谢

gridview

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)