Is there any way refresh cell's height without reload/reloadRow?

前端 未结 4 1073
忘掉有多难
忘掉有多难 2021-01-31 09:41

I make a view like imessage, just input text into the bottom text view. I use table view to do this, and the text view in the last cell. when I input long text that more than on

4条回答
  •  梦如初夏
    2021-01-31 10:20

    Table view cells won't smoothly resize. Dot.

    However, since your text view is in the last cell, you are lucky because you can easily simulate a row resizing. Having a text view in the middle of the table would be much more difficult.

    Here is how I would do it: put your text view on top of the table view. Sync its position with the contentOffset of the tableView in scrollViewDidScroll:. And use the animatable contentInset of the tableView in order to leave room for the textView, as the user types in it. You may have to make sure your textView is not scrollable.

提交回复
热议问题