簡體   English   中英

UITableViewCell中的多行標簽不適用於iOS 9或Swift 2.0

[英]Multiline Label within UITableViewCell not working with iOS 9 or Swift 2.0

我正在嘗試在表格視圖單元格中使用多行標簽。 我已經在iOS 8上測試了以下代碼,並且工作正常,並且單元格中的文本具有正確的行數。

// Make row heights adjustable
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
multiLineCell.indentationWidth = 10.0

multiLineCell.text = "Hello, here is some text which needs to be broken down into multiple lines in order for it to be displayed."

由於標簽內容發生更改,因此無法直觀地指定高度。 我將如何使單元格標簽在iOS 9和Swift中用多行顯示所有內容。

您尚未指定任何約束(也可能有問題,您需要為整個像元高度設置顯式約束),但是我懷疑問題可能出在

label.numberOfLines = 0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM