恩美第二个APP项目

cell自适应高度

2017-11-04  本文已影响37人  亲爱的八路

https://stackoverflow.com/questions/18746929/using-auto-layout-in-uitableview-for-dynamic-cell-layouts-variable-row-heights/18746930#18746930

一:
自定义的cell中,加入的子view要把cell的contentview的top和bottom都粘住
这样cell的中的元素就可以决定cell的contentview的高度
这种方法下面这个博客也有介绍,亲测可用
http://blog.csdn.net/studying_ios/article/details/54094305

二:
如果你的cell不仅仅高度会变化,更有多种布局,可以采用每种布局一个reuse id的做法。

上面两种方法不分系统版本,都可以使用

上一篇下一篇

猜你喜欢

热点阅读