forkingdog / UITableView-FDTemplateLayoutCell

Template auto layout cell for automatically UITableViewCell height calculating
MIT License
9.93k stars 2.01k forks source link

iOS10 Xcode8 中高度计算有问题 #245

Open binfy opened 8 years ago

binfy commented 8 years ago

unwanted constraint or constraints and fix it. ( UITableViewCellContentView:0x7ff18248a4c0.width == 375 UITableViewCellContentView:0x7ff18248a4c0.width == 0 ) 不知道怎么解决了

binfy commented 8 years ago

就是一个布局有问题,其他用到的都没问题,我先把手头的工作做完再看是什么原因吧?可能还是自己的布局有问题,待解决在来这里说。

binfy commented 8 years ago

那位兄弟知道这个啊

// Auto layout engine does its math fittingHeight = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height; 算这个高度的时候约束有问题,而且得到高度是900多,怎么解决呢? NSLayoutConstraint:0x17468c990 UITableViewCellContentView:0x153d532d0.width == 375, <NSLayoutConstraint:0x170890cc0 UITableViewCellContentView:0x153d532d0.width == 0

sh0rt2020 commented 8 years ago

@yrx0910 Maybe you should paste your code here. And make your problem clear.

binfy commented 8 years ago

@sunwell I just use this library to calculate the cell height.Below iOS 10 it runs normal. "fittingHeight = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;" this is the codes in the library.When runing to the codes ,i get the problem NSLayoutConstraint:0x17468c990 UITableViewCellContentView:0x153d532d0.width == 375, <NSLayoutConstraint:0x170890cc0 UITableViewCellContentView:0x153d532d0.width == 0

niyonqin commented 7 years ago

I solve this problem

  1. I give up the FD and then I use the _tableView.estimatedRowHeight = 80 in my tableview
  2. In the tableview's delegate, you must use this codes " [cell layoutIfNeeded] or [cell setNeedsLayout] " in the method - (UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath after you configure model.