UITableViewCell with dynamic height iOS

前端 未结 12 2327
日久生厌
日久生厌 2020-11-27 17:54

I have implemented TableView with CustomCell in my app,

I want dynamic height of my UITableViewCell according to text length in UITableViewCell

12条回答
  •  再見小時候
    2020-11-27 18:53

    I just wrote about this problem and the approach I finally chose. You can read about it here: Dynamic UITableView Cell Height Based on Contents

    Basically, I created a UITableView subclass that handles all this for both default and custom cells. It probably needs tweaking, but I have used it as is with good result.

    You can grab the code here: https://github.com/danielsaidi/DSTableViewWithDynamicHeight

    Hope it helps (...and if it didn't, I apologize and would love to hear why not)

提交回复
热议问题