滚动以在亚马逊应用程序中加载UITableView中的更多单元格 [英] Scrolling to load more cells in UITableView like Amazon app

查看:125
本文介绍了滚动以在亚马逊应用程序中加载UITableView中的更多单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个UITableView,当我滚动到列表底部时会自动加载更多行。这通常类似于iPhone的亚马逊应用程序上的搜索功能。它一次加载大约20行,当我滚动到前20行的末尾时,接下来的20会自动加载。加载后,它将保留在内存中。我没有考虑选项,其中最后一行显示加载更多项目,如App Store应用程序。

I am trying to create a UITableView where more rows loads automatically as I scroll to the bottom of the list. This is typically like the search function on the Amazon app for iPhone. It loads about 20 rows at a time and when I scroll to the end of the first 20, then the next 20 automatically load up. Once loaded, it remains in memory. I am not considering an option where the last row says "Load more items" like in the App store app.

这是我想要实现的:我当前的应用程序线程大约需要8-15秒来加载UITableView(列表中的0-50项)。即使只有一行,也需要大约8秒钟。我想让这个过程看起来更快。我的屏幕在任何给定的时间都可以显示最多7行,所以我想我是否可以一次加载8-10行并且能够实现这一点,比如3-4秒,然后另一行当用户向下滚动时,项目可以加载。因此,第一次加载表格的速度似乎是现在的两倍。

Here is what I am trying to achieve: My current app thread takes about 8-15 seconds to load the UITableView (anywhere from 0-50 items in list). It takes about 8 seconds even if there is just 1 row. I would like to make this process appear faster. My screen can display a max of 7 rows at any given time, so I am thinking if I can make this load 8-10 rows at a time and be able to achieve this in, let's say, 3-4 seconds, then the other items can load as the user scrolls all the way down. So, the first time loading of the table will appear to be twice as fast as it is now.

我一直在关注Tweetie2应用程序中的Pull to Refresh我也在github上查看Three20代码,但我不太清楚如何像亚马逊应用程序那样实现它。

I have been looking at "Pull to Refresh" like the Tweetie2 app and am also looking at Three20 code on github, but am not too sure how to get this implemented like the Amazon app.

主要关注如何使其加载更快,没有额外的用户输入。

The primary focus is on how to make it load faster and without additional user input.

任何帮助将不胜感激。

推荐答案

您是否考虑过使用UITableViewDelegate方法:

Have you consider using the UITableViewDelegate method:

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

如果你知道最后一个索引您已加载的单元格,如果您接近滚动到该单元格,则启动异步请求以加载更多行。

If you keep knowledge of the index of the last cell you have loaded and if you get close to scrolling to that cell, to start asynchronous requests to load more rows.

这篇关于滚动以在亚马逊应用程序中加载UITableView中的更多单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆