简体   繁体   English

如何布置可滚动的iPhone视图

[英]How to lay out scrollable iPhone view

I need advice on the most pragmatic way to layout the following view. 我需要有关最实用的布局以下视图的建议。 As you can see from the image attached, I have a static logo and text that appears at the top of the view, followed by a variable number of items. 正如您从所附图像中看到的那样,我有一个静态徽标和文本出现在视图顶部,然后是可变数量的项目。

Initially, I was going to use a TableView for the variable number of items, that way I would be able to load any given number of cells at runtime. 最初,我将使用TableView表示可变数量的项目,这样,我将能够在运行时加载任何给定数量的单元格。

My problem is that if I drop a tableView onto this view below my static logo and text, when the user scrolls, the static logo and text will remain fixed. 我的问题是,如果将tableView放在静态徽标和文本下方的此视图上,则当用户滚动时,静态徽标和文本将保持固定。 I need both the static logo/text AND the tableView to scroll up. 我需要静态徽标/文本和tableView才能向上滚动。

My next inclination is to use a scrollView, inside which I would place my tableView and static logo. 我的下一个倾向是使用scrollView,在其中放置tableView和静态徽标。

Is this the most pragmatic way to approach the problem? 这是解决问题的最实用方法吗? If so, will there be usability issues when scrolling the scrollView vs scrolling the tableView? 如果是这样,在滚动scrollView与滚动tableView时是否会存在可用性问题? In my mind this could get messy. 在我看来,这可能会变得混乱。

Any advice on the best way to approach this is greatly appreciated. 非常感谢您提供有关解决此问题的最佳方法的建议。

内容

Using a table view inside of a scroll view is a bad idea and warned against by Apple in their docs. 在滚动视图中使用表格视图是一个坏主意,Apple在其文档中对此提出警告。 Basically the internal gesture recognizers can conflict and create a clunky user experience. 基本上,内部手势识别器可能会冲突并创建笨拙的用户体验。 The best path forward would be to go with the tableview (which is a subclass of scroll view) and have two different kinds of cells– one for the logo and one for the repeating contents at the bottom. 最好的前进方法是使用tableview(滚动视图的子类),并具有两种不同类型的单元格–一种用于徽标,一种用于底部的重复内容。 Make the first cell the logo and adjust the table view's settings to format it to your heart's content. 将第一个单元格设置为徽标,并调整表格视图的设置以将其格式化为您喜欢的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM