iOS 8.3打破了自动单元格高度 [英] iOS 8.3 breaks automatic cell height

查看:147
本文介绍了iOS 8.3打破了自动单元格高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长期读者,第一次海报。

Long time reader, first time poster.

我在我的应用程序中使用自动单元格高度和自动布局。在iOS 8.3和8.4中,这似乎被打破了。我有一个示例项目。当在8.2或更低版本中构建时,它可以正常工作。细胞高度由Autolayout决定。当在8.3或8.4中构建时,它不起作用。我在网上搜索过,我没有看到有人发布这个问题。

I use automatic cell height with auto layout in my app. In iOS 8.3 and 8.4, this appears to be broken. I have a sample project. When built in 8.2 or lower, it works properly. The cell heights are determined by Autolayout. When built in 8.3 or 8.4 it doesn't work. I have searched online and I don't see anyone posting about this issue.

看看下面的截图。任何帮助表示赞赏。

Take a look at the screenshots below. Any help is appreciated.

Cell Height Project ZIP

截图对比http:/ /jeffburg.com/skitch/CellHeightProjectComparison.png

谢谢!
-Jeff

Thanks! -Jeff

推荐答案

我检查了你的代码并发现了问题。

I checked your code and found the problem.

通过AppCodas 关于自我调整单元格的文章阅读,它看起来像使用 UITableViewAutomaticDimension 时,你应该使用 estimatedRowHeight (我自己没有使用它,无法确认)。因此,请删除以下行:

Reading through AppCodas article about self-sizing cells, it looks like you should use estimatedRowHeight when using UITableViewAutomaticDimension (haven't used it myself, cannot confirm). So either remove the following line:

self.tableView.rowHeight = UITableViewAutomaticDimension

或添加(如果您的单元格高度将根据内容发生变化):

or add (if your cell height will be changing based on content):

self.tableView.estimatedRowHeight = 122;

这篇关于iOS 8.3打破了自动单元格高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆