How to create a toolbar between UITableView rows

前端 未结 6 1702
终归单人心
终归单人心 2020-12-12 09:05

I am interested on how tweetbot does the following:

\"Enter

I would like to cr

6条回答
  •  醉梦人生
    2020-12-12 10:07

    Here's what I'm doing to get the animation to be clean.

    In addition to the strategy user fluchtpunkt suggests (that is, adding a subview to the cell, updating the cell height via heightForRowAtIndexPath, beginUpdates, and endUpdates), I'm finding the following measures to be helpful with the animation:

    1. The tableviewcells have a background image. Otherwise, the added subview/toolbar is visible through the cell just before the tableview animates the height change.
    2. The tableviewcell is 'behind' the view that is the cell below it, otherwise again the subview/toolbar will show too soon. I'm using [tableview sendSubviewToBack:cell]; and it's taking care of that.

    This is clean for me, but not exactly like Tweetbot. Interestingly, Tweetbot's animation seems to pull the toolbar down as the bottom of the cell animates down. It seems like some additional animation must be taking place, or my conspiracy theory is that it is actually adding the subview to the top of the cell below the selected cell, and then performing the lengthening and animation on the cell below.

提交回复
热议问题