使用iOS 8灵活表格单元格,单元格高度更改但文本不会换行 [英] Using iOS 8 flexible table cells, cell height changes but text doesn't wrap
问题描述
我正在尝试使用在iOS 8中创建灵活高度单元格的新方法,通过使用以下两行代码进行实例化:
I'm trying to use the new method of creating flexible height cells in iOS 8 by instantiating with these two lines of code:
tableView.estimatedRowHeight = 100.0
tableView.rowHeight = UITableViewAutomatic Dimension
我是设置所有满意的autolayout约束。当我输入消息这是一条测试消息。表格单元格调整该短消息的正确高度。
I've set autolayout constraints that all satisfied. When I put in the message "This is a test message." the table cell adjusts for the correct height for that short message.
然而,当我尝试添加导致文本换行的文本时(在这种情况下我只是复制并粘贴) 这是一条测试信息。9倍以上),单元格高度调整为新内容,但文本不会换行。我已经将标签上的行数设置为0.想法?
However when I try to add text that causes the text to wrap (in this case I just copied and pasted "This is a test message." 9 times over), the cell height adjusts for the new content but the text doesn't wrap. I've set the number of lines on the label to 0. Thoughts?
推荐答案
创建一个新的表格单元并调整其中一个我的压缩阻力优先级为751而不是750.
Created a new table cell and tweaked one of my labels compression resistance priorities to be 751 instead of 750.
这篇关于使用iOS 8灵活表格单元格,单元格高度更改但文本不会换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!