iOS 8: UITableViewCell detail text not correctly updating

后端 未结 8 761
有刺的猬
有刺的猬 2020-12-30 02:32

tl;dr: Can I cause the detailTextLabel to have its size updated by the auto layout system in iOS on a value change?

Has anyone else had issues with the detailText l

8条回答
  •  不知归路
    2020-12-30 03:08

    I have same problem with cell not updating correctly when using segue in storyboard. Tried

    [setNeedsLayout] and [layoutIfNeeded]
    

    on the view and the tableview and it is NOT working.

    [self.tableView reloadData] is in viewDidAppear, as it should.
    

    Then I tried the advice from pixbug, and it worked. But one should NOT use [layoutSubviews] directly. So I tried the ones that is adviced by the documents on the cell instead of tableView or the view.

    Tried

    [cell setNeedsLayout] 
    

    but this did NOT work.

    Tried

    [cell layoutIfNeeded] 
    

    this WORKED for me.

    I put this before returning the cell.

提交回复
热议问题