美文网首页
tableView(_ tableView: UITableVi

tableView(_ tableView: UITableVi

作者: yeshenchen | 来源:发表于2020-09-16 11:18 被阅读0次

tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell报错显示没有初始化问题:

起初一直以为是nib文件注册有问题

仔细debug发现,是在返回cell高度的sdAutoLayout中出了错

代码:letheight:CGFloat=self.cellHeight(for: indexPath, cellContentViewWidth:SFScreenWidth, tableView: tableView)

再次跟进去,原来里面调了:overridefunctableView(_tableView:UITableView, cellForRowAt indexPath:IndexPath) ->UITableViewCell出错了

总结,报错位置并不一定准确,很多时候都是如此,如果发现报错位置代码没毛病,一定要全面仔细跟代码,打断点更为准确

相关文章

网友评论

      本文标题:tableView(_ tableView: UITableVi

      本文链接:https://www.haomeiwen.com/subject/fcpcyktx.html