我们可以在 UITableViewCell 中添加滚动视图吗?
我有一个要求,我必须显示一些根据所属组进行区分的图像。我使用表格视图来查看组下列出的图像。用户必须水平滚动才能查看特定组中的更多图像。 我们可以向 tableview 行添加滚动视图以允许用户水平滚动图像列表吗? 我搜索了一下,一些评论说它在苹果的 HIG 中是不允许的一些评论说 你可以将 UIScrollView 添加到 UITableViewCell 中,只要你设置UIScrollView 的 contentSize 属性正确,那么 UIScrollView 将在水平轴上正确滚动
我可以得到任何确认吗? 或者任何替代方法来实现不同数据的水平和垂直滚动而不使用表视图
I have requirement where I have to show some images which are differentiated according to Groups they belong to. I have used a table view to view images listed under groups. User has to scroll horizontally to view more images in a particular group.
Can we add a scroll view to tableview row to allow user to scroll list of images horizontally?
I searched a bit, some comments say its not allowed in apple's HIG some comments say
You can add a UIScrollView to a UITableViewCell and as long as you set the contentSize property of the UIScrollView correctly then the UIScrollView will scroll correctly in the horizontal axis
May I get any confirmation on this ??
Or any alternative approach to achieve horizontal and vertical scrolling for different data without using tableview
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,这绝对是可能且合理的。
这是 Felipe Laso 编写的优秀教程,分步解释:
如何使用水平表(如 Pulse News 应用程序)创建界面:部分1
如何使用水平表格制作界面(如 Pulse News 应用程序:第 2 部分)
顺便说一句,该教程中描述的方法比向每个单元格添加 UIScrollview 更有效。
Yes it is definitively possible and reasonable.
Here is an excellent tutorial by Felipe Laso that explains it step by step:
How To Make An Interface With Horizontal Tables Like The Pulse News App: Part 1
How To Make An Interface With Horizontal Tables Like The Pulse News App: Part 2
BTW, the approach described in that tutorial is way more efficient than adding a UIScrollview to each cell.
当然你可以在tableView中添加scrollView。
现在您可以相应地设置滚动视图的属性。
Of course you can add scrollView in tableView.
Now you can set properties for scroll view accordingly.
当然,这是可能的。 UITableCellView 内的 UIScrollView 可以正常工作 - HIG 说不,可能是因为它很难使用。用户必须准确地向上/向下或向左/向右滚动,这可能会很烦人。不应该花很长时间来完成快速测试。
我有一个带有 2 个滚动视图的应用程序 - 一个允许水平滚动,然后在另一个允许垂直滚动的滚动视图内。这个想法是,用户可以向上/向下滑动页面,然后也可以在页面之间向左/向右滑动。
使用起来不太好,但这是我的客户想要的;)
要使 UIScrollView 只响应水平或垂直滚动,就需要设置正确的 contentSize。希望这有一些帮助。
Sure, this is possible. A UIScrollView inside a UITableCellView will work fine - the HIG says no, probably because it'll be hard to use. The user would have to accuratley scroll either up/down, or left/right and it might be annoying. Shouldn't take long to knock together a quick test.
I have an app with 2 scrollviews - one that allows horizontal scroll, and then inside that another scrollview which allows vertical scroll. The idea is that the user can flick up/down a page, then also flick left/right across pages.
It's not that nice to use, but it's what my client wanted ;)
To make a UIScrollView only respond to horizontal or vertical scroll is all about setting the correct contentSize. Hope this is some help.