首页 > 技术文章 > Swift 给UITableView 写extension 时 报错 does not conform to protocol 'UITableViewDataSource'

ZhangShengjie 2017-05-04 12:44 原文

那是因为你没有实现 数据源和代理方法 实现下就好了  

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


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

 

推荐阅读