set delegate and datasource of uitableview programmatically in Swift

后端 未结 2 1206
梦如初夏
梦如初夏 2021-01-16 21:29

I would like to set the delegate and datasource for \'tableViewinViewController.swift` file.

I wrote this code in my viewDidL

2条回答
  •  Happy的楠姐
    2021-01-16 21:42

    The correct way to set the delegate and data source is:

    tableView.delegate = self
    tableView.dataSource = self
    

提交回复
热议问题