本文介绍了如何在App Store中创建“特色页面"之类的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发的新手.基于我的假设,App Store中的Feature页面是使用UITableView和UICollectionView的组合创建的.但是,如何在理论和代码上做到这一点呢?我知道它有点模糊,因为很难描述它,但是我只需要一些人来帮助我解释它.

I'm new in iOS development. Based on my assumption, Feature page in App Store was created using a combination of UITableView and UICollectionView. But how to do that in theory and code? I know it's a bit vague, because it's quite hard to describe it, but I just need some people to help me explain it.

在这种情况下,我将尝试使用以下命名方式:

For this case I will try to use these naming:

1..顶部是显示应用横幅的视图,人们可以滑动它来查看其他横幅.
2..中间部分,可以水平滚动的视图. (最佳新应用程序,最佳新游戏等).
3.底部,从快速链接到底部.

1. Top section, it's a view which showing banners of apps, people can swipe it to view another banner.
2. Middle section, views which can be scrolled horizontally. (Best New Apps, Best New Games, etc).
3. Bottom section, starts from Quick Links to the bottom.

问题:

1..滚动指示器是从根视图的顶部向导开始的,这很正常,但是:
a..当我们向上滚动时,反弹从中间部分开始.怎么做?顶部和中间部分是分开的视图吗?但是,如果顶部和中间部分是分开的视图,那么如何从根视图的顶部向导中启动滚动指示器? (分离的视图意味着视图应该具有不同的滚动指示器,除非它实际上是UIScrollView的子视图.)
b..当我们向下滚动时,没有漂浮的东西.因此,看起来整个页面是单个滚动视图的子视图,但反弹性从中间部分开始.如何在整个页面只有一个滚动指示器的情况下创建那种反弹效果?

1. The scroll indicator is starts from the root view's top guide, that's normal, but:
a. When we scroll it up, the bounciness is start from the middle section. How to do that? Is the top section and middle section is a separated view? But how can the scroll indicator is started from the root view's top guide if top and middle section is a separated view? (Separated view means that the views should have different scroll indicator unless it's actually subviews of UIScrollView).
b. When we scroll it down, there is nothing that floating. So it looks like that the whole page is a subview of a single scroll view but the bounciness is starts from the middle section. How to create that bounciness effect while only have one scroll indicator for the whole page?

2..在中间部分,有几个具有水平滚动方向的集合视图.最好的创建方法是将UITableView与内部具有UICollectionView的单元格一起使用吗?看起来是用这种方式创建的,但是:
a.?这是最有效的方法吗?
b.因为我的第一个问题是我的困惑之源.

2. In the middle section, there's a several collection view that has horizontal scroll direction. Is it the best way to create it like that is to use UITableView with cell that has UICollectionView inside it? It looks like it was created that way, but:
a. Is it the most efficient way to do that?
b. Because of the case in my first question is my source of confusion.

3..底部部分与中间部分的分隔符不同.中间部分有凹痕,而底部没有.如果是UITableView,该怎么办?

3. The bottoms section has a different separator from the middle section. The middle section has indentation while the bottom section doesn't. How can I do that if the case is it's a UITableView?

我的整个问题就是如何创建这样的布局.如果您不能通过提供一些很好的示例代码来帮助我,请向我解释如何执行此操作的概念或理论.

如果整个答案只是我必须使用垂直/水平的UIScrollView从头开始创建它,那很好.我只是想确保这一点,因为我试图避免处理手动拼贴.

If the whole answer is just I have to create it using vertical/horizontal UIScrollView from scratch that's fine. I just want to make sure of that since I tried to avoid dealing with creating manual tiling.

推荐答案

好的,我想我终于找到了自己的答案.

OK, I think I finally found my own answer.

  1. 首先,我需要一个UIScrollView作为视图的根.然后将contentSize设置为特定值.
  2. 顶部可以是UIPageController或水平UIScrollView.
  3. 中间部分是UITableView,其scrollEnabled为NO,并且单元格是静态的.静态单元格(也可以是动态单元格)将包含UICollectionView.由于滚动被禁用,它将使用父UIScrollView中的滚动.这就是为什么我可以在中间部分获得相同的弹力效果的原因.
  4. 底部是UITableView的另一个单元格.

谢谢.

这篇关于如何在App Store中创建“特色页面"之类的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 17:06