UITableVIew header without bouncing when pull down

前端 未结 3 1418
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 20:39

I have a UITableView which I am able to add a header view to fairly easily. Many apps (like Facebook, for viewing events) have a headerView that when you pull d

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 21:36

    Your UITableView is most likely working properly. Section headers are sticky by default in Plain style tables. Meaning as you scroll down the header stays at the top of the UITableView's frame until the next section header pushes it out of the way. The opposite occurs when you scroll up. Conversely you get the sticky behavior on section footers at the bottom of the UITableView's frame.

    EDIT Misunderstood the original question:

    I would suggest using a section header rather than the table view header to get the sticky behavior you're looking for.

    Include a section in your data with no rows and put your table header's view in that section header view.

提交回复
热议问题