use single table view controller for each collection view cell press

后端 未结 1 1023
故里飘歌
故里飘歌 2021-01-26 10:36

i have 5 collection view cell with name \"Resturants\", \"shops\", \"Medical\" , \"parlor\" , \"parks\" so on. So now i set like, 10 view controller and i place table view insid

1条回答
  •  清酒与你
    2021-01-26 11:06

    Store category names in an array or elsewhere, anytime cell is pushed you call the certain category by selecting it from the array as follows

    categoryArray[indexPath.row]
    

    Then when the transition to another view is about to be done you check what category has been selected and you populate the tableview with relevant data. You can set up a structure like so:

    func determineDataSource()
    {
      switch category
      {
        case "Restaurant":
          print("restaurant")
    .
    .
    .
    }
    

    0 讨论(0)
提交回复
热议问题