本文介绍了具有固定标题反弹效果的列表,如 App Store的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做一个UITableView,有一个固定的header,比如App Store,在header下面有弹跳效果:

我尝试了

我的观点:

解决方案

我终于找到了一个解决方案.基本上我创建了一个 UITableView 和一个标题,两者都具有清晰的背景颜色.然后我在控制器视图和 tableView 之间添加一个新视图(与标题 tableView 具有相同的高度),位于顶部.这个新视图是标题.然后我使用函数 scrollViewDidScroll 来管理模拟标题的视图的位置.这样我就可以在header下方的tableView中实现反弹

我做了一个例子,你可以在这里下载

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

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

My View:

解决方案

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

这篇关于具有固定标题反弹效果的列表,如 App Store的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 22:22