ios - How can I use UICollectionViewCells in the UITableViewcells -
where 1 of tableviewcell must have collectionview , other custom tableviewcells have different number of labels , imageviews.here code viewcontroller:
func tableview(_tableview:uitableview,numberofrowsinsection section: int)->int{ return seachable.count } func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell { if seachable[indexpath.row].first.name != nil{ let cell = tableview.dequeuereusablecell(withidentifier: "cell1", for: indexpath) as! fristtableviewcell cell.firstone.text = seachable[indexpath.row].first.name return cell } .........and on else { let cell=tableview.dequeuereusablecell(withidentifier:"cell4",for: indexpath) as! fourtableviewcell cell.collectioinview1.reloaddata() return cell }
below code tableviewcell collectionview:
extension fourtableviewcell : uicollectionviewdatasource,uicollectionviewdelegate { func numberofsections(in collectionview: uicollectionview) -> int { return 1 } func collectionview(_ collectionview: uicollectionview, numberofitemsinsection section: int) -> int { return 10 } func collectionview(_ collectionview: uicollectionview, cellforitemat indexpath: indexpath) -> uicollectionviewcell { let cell = collectionview.dequeuereusablecell(withreuseidentifier: "collectioncell", for: indexpath) as! onecollectionviewcell cell.collectioncelllabel.text = "a" return cell } }
the error have :the behavior of uicollectionviewflowlayout not defined because:
Comments
Post a Comment