Swift - UITableViewAutomaticDimension 不起作用的解决办法

Swift - UITableViewAutomaticDimension 不起作用的解决办法,第1张

概述## 问题 学习swift过程中遇到了个问题就是UITableView的高度自适应UITableViewAutomaticDimension不起作用,并且还报了个 [Warning] [Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a t

## 问题
学习swift过程中遇到了个问题就是UItableVIEw的高度自适应UItableVIEwautomaticDimension不起作用,并且还报了个 [Warning]

[Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tablevIEw cell's content vIEw. We're consIDering the collapse unintentional and using standard height instead.

通用代码设置为:

self.tableVIEw.estimatedRowHeight = 120self.tableVIEw.rowHeight = UItableVIEwautomaticDimension

但运行效果却为:

解决方法

Google 一番之后,发现原来是我的cell里的控件没有做bottom约束(autoLayout) ,所以加上Bottom约束之后的效果为:

完美

总结

以上是内存溢出为你收集整理的Swift - UITableViewAutomaticDimension 不起作用的解决办法全部内容,希望文章能够帮你解决Swift - UITableViewAutomaticDimension 不起作用的解决办法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1058968.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存