Custom UITableView Dynamic Cell Height

前端 未结 6 636
一个人的身影
一个人的身影 2021-02-06 09:22

I have search and searched through endless blogs and articles on how to determine a dynamic height for a custom UITableViewCell and its detailed text. I have really had a hard t

6条回答
  •  醉酒成梦
    2021-02-06 09:57

    I just wrote about this problem and how I finally decided to solve it. You can read about it here: Dynamic UITableView Cell Height Based on Contents

    Basically, I created a UITableView subclass that automates the handling and calculation of dynamic cell height for both default and custom cells. It is not a silver bullet and probably needs to be extended and tweaked, but I have used it as is in several apps with good result.

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

    Hope it helps!

    (...and if it didn't, I'd love to hear why not)

提交回复
热议问题