简体   繁体   English

在iPhone的UITable(逐行)中实现水平滚动

[英]Implementing horizontal scrolling in a UITable (row by row) for iPhone

As per the question, I'm looking to implement a video selector with different categories. 根据问题,我正在寻求实现具有不同类别的视频选择器。 This would be very similar to the BBC app in approach. 这与方法中的BBC应用程序非常相似。 I don't seem to be able to find anything that fits the bill though, has anyone got any good ideas for how I might be able to do this/an API freely available that does it. 我似乎找不到合适的东西,没有人对我如何做到这一点/可以免费使用的API有任何好的建议。 See example: 参见示例:

http://www.bbc.co.uk/blogs/bbcinternet/img/BBC_News_app_portrait_BBC_copyright.PNG http://www.bbc.co.uk/blogs/bbcinternet/img/BBC_News_app_portrait_BBC_copyright.PNG

Here is a great tutorial, with example project showing an effective way to implement vertical and horizontal scrolling. 这是一个很棒的教程,示例项目显示了实现垂直和水平滚动的有效方法。

http://www.raywenderlich.com/4680/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-1 http://www.raywenderlich.com/4680/how-to-make-an-interface-with-horizo​​ntal-tables-like-the-pulse-news-app-part-1

You have to use scrollview instead of tableview for this case. 在这种情况下,您必须使用scrollview而不是tableview。

You can make a custom view for each of the news items and can be added to the scrollview. 您可以为每个新闻项创建自定义视图,并且可以将其添加到滚动视图。

The easiest way to do this would be to create a simple UITableView and, inside each cell, create a UIScrollView :) 最简单的方法是创建一个简单的UITableView,并在每个单元格内创建一个UIScrollView :)

UIScrollView *myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,100)];
myScrollView.delegate = self;
myScrollView.contentSize = CGSizeMake(2000,100);

for(int i = 0; i < [myData count]; i++) {
// Add your content here
}

You can start from this pageControl sample code. 您可以从此pageControl示例代码开始。 It has horizontal scrolling with pages. 它具有页面水平滚动。

I suggest to use three20 classes. 我建议使用three20类。

There are downloadable from here: https://github.com/facebook/three20 从这里可以下载: https : //github.com/facebook/three20

In sample code you can find horizontally table scroll. 在示例代码中,您可以找到水平表格滚动。
Easy and beatiful! 简单而美丽!

A 一种

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

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