UITableView with dynamic cell heights jumping when scrolling up after reloading cell

后端 未结 5 1416
孤街浪徒
孤街浪徒 2021-02-05 13:21

I have a table view with the potential for each cell to have its own height, thus isn\'t suitable to use rowHeight. Instead, right now I\'m using let indexSet

5条回答
  •  深忆病人
    2021-02-05 14:04

    Uh... this is kind of hard issue to deal with.

    Let's take a look at facebook. They had this same issue with their timeline, and they ended up doing it in some kind of web view.

    I had a similar issue with some kind of timeline, used automatic row height and had that issue. First thing to resolve it was to set estimatedHeight as close as possible to average cell height. That is pretty hard to deal with since you may have text (height 50) or images + text ( height 1500). Next thing to do with improving this was implementing estimatedHeight forIndexPath which basicly return different estimated height for different indexPaths.

    After that there were a lot of other solutions but this was as closest as it can with variable heights (huge differences).

提交回复
热议问题