私のアプリケーションでは、アイテムを表示します。私のJSON
フィードには 50 個のアイテムが含まれていますが、最初に 25 個を表示したいと考えており、ユーザーが最後の行までスクロールすると、さらにアイテムをロードする必要があります。
私がやっている:
JSON
フィードのダウンロード;
NSString *jsonString = [NSString
stringWithContentsOfURL:[NSURL URLWithString:xmlDataUrl]
encoding:NSStringEncodingConversionAllowLossy
error:nil];
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *results = [parser objectWithString:jsonString error:nil];
parser = nil;
[self setTableData:[results objectForKey:@"feed"]];
///
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
///
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
//return [tableData count];
return 25;
}
そして最後の行を検出します:
if(indexPath.row == [self.tableData count] - 1)
{
NSLog(@"Last Row");
}
しかし、最後の行を検出していません。これは、ダウンロードしている JSON に 25 行を超える行が含まれているためですか?
そして、どうすれば新しい行を追加[self.tableDate count] +1;
できますか?
返さ[tableData count];
れた場合、最後の行を検出していますが、行はすでに 100% 埋められています。+1 よりも 25/50 を表示する必要があります。