Ios 如何滚动collectionview并传递从collectionviewcell内部的tableview中选择的数据

Ios 如何滚动collectionview并传递从collectionviewcell内部的tableview中选择的数据,ios,swift,Ios,Swift,我有collectionview。在collectionview单元格中,我的代码如下:- 类标题单元格:UICollectionViewCell、UITableViewDataSource、RadioDummyTableViewCellDelegate{ @IBOutlet weak var tableView: UITableView! let cellIdentifier: String = "tableCell" var optionsModelArray:[O

我有collectionview。在collectionview单元格中,我的代码如下:-

类标题单元格:UICollectionViewCell、UITableViewDataSource、RadioDummyTableViewCellDelegate{

  @IBOutlet weak var tableView: UITableView!


    let cellIdentifier: String = "tableCell"

    var optionsModelArray:[OptionsModel] = []

    var options:[String]? = []

    var questionviewmodel:DummyDataModel!

    @IBOutlet weak var lblName: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code


        // tableView.delegate = self
       tableView.dataSource = self


      //  tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
      tableView.register(UINib(nibName: "DummyDataHeader", bundle: nil), forCellReuseIdentifier: "cell")

   }


    func setReviewData(reviews:DummyDataModel)

    {
        self.lblName.text = reviews.question
        print(self.lblName.text)

        print(reviews.options)


        for values in reviews.options!{

            print(values)

            let optionmodel = OptionsModel(values: values)
            self.optionsModelArray.append(optionmodel)
        }
    }

      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return self.optionsModelArray.count

    }


    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

        return 44

    }


    func datafordisplay(atindex indexPath: IndexPath) -> NH_OptionsModel{


        return self.optionsModelArray[indexPath.row]

    }


    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! DummyDataHeader

        cell.setOptions(Options1:datafordisplay(atindex: indexPath))

        cell.delegate1 = self



        return cell

    }
所以在collectionviewcell中我有tableview

在tableviewcell中:-

//use of protocol in button action
protocol NHRadioDummyTableViewCellDelegate : class {
    //function
    func swiftyTableViewCellDidTapRadio(_ sender: DummyDataHeader)
}



class DummyDataHeader: UITableViewCell {


    var delegate1:RadioDummyTableViewCellDelegate?
  func setReviewData(reviews:OptionsModel)

    {
        self.optionLabel?.text = reviews.values
        print(self.optionLabel?.text)
    }


}
问题是


当我选择tableview单元格时,我需要滚动collectionview单元格以及tableview的数据。

在collectionview单元格而不是tableview单元格中添加委托。在collectionview单元格中实现tableview didselectrow at index方法,并在其中调用委托函数

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
    guard let cell = tableView.cellforRowAt(indexPath) as? DummyDataHeader else { return }
    delegate?.swiftyTableViewCellDidTapRadio(cell)
} 

你能适当地解释一下你的最后一句话,以便更好地帮助你吗。