嗨...他们实际上是如何实现的?Twitter个人资料页面有一些教程。但是它们无法处理所有可能性...首先...当您在任何位置滚动顶部或底部时,顶视图开始滚动,直到分段控件到达页面顶部...然后滚动不会停止并且无法进行子表化开始滚动直到触及中途并且tableview中途开始动态加载其他行...所以我不认为它们静态设置了scrollview的内容
第二件事,他们如何处理子表...它们是containerView吗?如果是这样,那么结构将像这样
ScrollView
TopView (User Info)
Segmented Controll
scrollView(to swipe right or left changing tables)
ContainerView For TWEETS
ContainerView For TWEETS & REPLIES
ContainerView For MEDIA
ContainerView For LIKES
Run Code Online (Sandbox Code Playgroud)
我对吗?因此,他们如何处理子表和“顶滚动视图”之间的滚动以实现基于滚动的顶视图位置更改...
令人不寒而栗
这就是我如何处理嵌套的ScrollViews ...我制作了childDidScroll协议,并且我的子tableviews实现了这一点,在我的个人资料页面中,我可以在childDidScroll方法中接收所有子didscroll事件:
//if child scrollview going up
if(scrollView.panGestureRecognizer.translation(in: scrollView.superview).y > 0)
{
//check top scrollview if it is at bottom or top
//then disable the current scrollview
if mainScrollView.isAtBottom && scrollView.isAtTop{
scrollView.isScrollEnabled = false
}else{
//else enable scrolling for my childs
featuresVC.tableView!.isScrollEnabled = true
categoriesVC.tableView!.isScrollEnabled = true
shopsVC.tableView!.isScrollEnabled = …Run Code Online (Sandbox Code Playgroud)