【问题标题】:How to dynamically expand indexpath row in tableview?如何在tableview中动态扩展indexpath行?
【发布时间】:2016-07-15 12:37:27
【问题描述】:

根据 UILabel 高度动态扩展 Tableview 索引路径行的高度。

我试了很多次还是不行。

【问题讨论】:

    标签: ios uitableview swift2 uilabel


    【解决方案1】:

    设置UILabel的约束

    然后将这一行写入viewDidLoad

    self.tableView.estimatedRowHeight = 170;
     self.tableView.rowHeight = UITableViewAutomaticDimension;
    

    并使用这个委托

     func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
            return UITableViewAutomaticDimension
        }
    

    【讨论】:

      猜你喜欢
      • 2018-06-23
      • 1970-01-01
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多