List with fixed header bounce effect like App Stor

2019-05-31 04:22发布

I want to make a UITableView with a fixed header, like the App Store, with the bounce effect below the header:

App Store GIF

I've tried a UIScrollView with a UITableView with scrollEnabled NO. Didn't work; it didn't make the bounce effect below the header:

enter image description here

My View: enter image description here

1条回答
Root(大扎)
2楼-- · 2019-05-31 05:10

I finally found one solution. Basically I created a UITableView and a header, both with clear background color. Then I add a new view (with the same height that the header tableView has), between the controller view and tableView, positioned at the top. This new view is the header. I then use the function scrollViewDidScroll to manage the position of the view that simulates the header. This way I could achieve the bounce in the tableView below the header

I have made an example, you can download it here

查看更多
登录 后发表回答