Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone ';直播';UITableView-以小部分的形式从服务器获取数据_Iphone_Ios_Objective C_Rest_Web - Fatal编程技术网

Iphone ';直播';UITableView-以小部分的形式从服务器获取数据

Iphone ';直播';UITableView-以小部分的形式从服务器获取数据,iphone,ios,objective-c,rest,web,Iphone,Ios,Objective C,Rest,Web,如何在iOS下创建live UITableView 我知道,我想创建一个连接到用JAVA编写的服务器的应用程序。POST请求下的服务器返回数据映射表(JSON格式)。问题是,数据可能非常大(大约100000个记录)。我已经在服务器端实现了部分返回数据(当POST具有offset和size参数时,服务器将数据从offset返回到(offset+size)和数据总数) 问题是我不知道如何用iOS实现它 我知道如何使UITableView处理从服务器下载的数据,但我不知道如何使UITableView处

如何在iOS下创建live UITableView

我知道,我想创建一个连接到用JAVA编写的服务器的应用程序。POST请求下的服务器返回数据映射表(JSON格式)。问题是,数据可能非常大(大约100000个记录)。我已经在服务器端实现了部分返回数据(当POST具有offset和size参数时,服务器将数据从offset返回到(offset+size)和数据总数)

问题是我不知道如何用iOS实现它


我知道如何使UITableView处理从服务器下载的数据,但我不知道如何使UITableView处理部分数据:例如:在进入查看时,我只下载100000表中的100行,当用户向下滚动(例如到80行)时,我下载下一部分数据。我的意思是我不想在内存中存储整个100000行,而只想在表视图中显示200行。当用户滚动到表的末尾时,在内存中,我应该有从99800到100000的行

当用户滚动
表视图
时,我们将检查是否到达最后一个单元格如果到达最后一个单元格,我们将下载下一个
数据集
,如下所示:

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

    NSInteger sectionsAmount = [tableView numberOfSections];
    NSInteger rowsAmount = [tableView numberOfRowsInSection:[indexPath section]];

    if ([indexPath section] == sectionsAmount - 1 && [indexPath row] == rowsAmount - 1) {
        // This is the last cell in the table
        //Here you can download the next part of dataset and reload the tableView.
     }
} 

希望这能对你有所帮助。

你能指出你的确切问题吗。。。比如,它是将json转换成NSDictionary还是创建tableView或其他什么?是的,我可以将json转换成NSDictionary。我知道如何使UITableView处理从服务器下载的数据,但我不知道如何使UITableView处理部分数据:例如:在进入查看时,我只下载100000表中的100行,当用户向下滚动(例如到80行)时,我下载下一部分数据。我不想在内存中存储整个100000行,但只有200行可以在表视图中显示。我的答案对您有帮助吗?…如果您接受答案,如果它解决了您的问题,我将不胜感激。