これがストーリーボードの画像です。UITableViewCell
ストーリーボードからドラッグアンドドロップして行の高さを変更してみた動的なテーブルビューセルを使用しましたが、実行時にセルの高さを拡張できません。
でXcode 9.0.1
とSwift 4
、私はruntime.soで増加していないセルの高さに関する問題に直面しています、plsはこの問題を解決するために私を助けて。
行の高さと推定行の高さの自動ディメンションを設定するには、次の手順を実行して、セル/行の高さのレイアウトに自動ディメンションを有効にします。
UITableViewAutomaticDimension
rowHeightとestimatedRowHeightに割り当てますheightForRowAt
、値UITableViewAutomaticDimension
を返します)-
@IBOutlet weak var table: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Don't forget to set dataSource and delegate for table
table.dataSource = self
table.delegate = self
// Set automatic dimensions for row height
table.rowHeight = UITableViewAutomaticDimension
table.estimatedRowHeight = UITableViewAutomaticDimension
}
// UITableViewAutomaticDimension calculates height of label contents/text
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
UITableviewCellのラベルインスタンスの場合
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加