Wrong UITableViewCell height with UITableViewAutomaticDimension

前端 未结 4 1737
盖世英雄少女心
盖世英雄少女心 2021-02-09 08:05

I make custom cell with 2 multiline labels and pin this labels to all sides. When in -tableView:heightForRowAtIndexPath: for iOS >= 8 I return

4条回答
  •  天命终不由人
    2021-02-09 08:50

    Set automatic dimension in viewDidLoad() method or viewWillAppear() (both code in same place)

        tableView.rowHeight = UITableViewAutomaticDimension;
        tableView.estimatedRowHeight = 160.0;//(Maximum Height that should be assigned to your cell)
    

    Visit Using Auto Layout in UITableView for dynamic cell layouts & variable row heights an intuitive guide for both iOS 7 and iOS 8

提交回复
热议问题