set delegate and datasource of uitableview programmatically in Swift

后端 未结 2 1179
梦如初夏
梦如初夏 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条回答
  • 2021-01-16 21:42

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

    tableView.delegate = self
    tableView.dataSource = self
    
    0 讨论(0)
  • 2021-01-16 21:44

    Do this, it will work

    tableView.delegate      =   self
    tableView.dataSource    =   self
    
    0 讨论(0)
提交回复
热议问题