PHPを使用してMySQLデータベースの最初の25項目を取得するXMLを解析しています-LIMITとGET。テーブルビューの下部に追加する[さらに読み込む]セルをクリックすると、次の25個のアイテムが正常に取得されますが、最初の40個のみが読み込まれ、最後の10個は省略されます。[さらに読み込む]をクリックするたびに"セルは私の範囲に25を追加します(つまり、0-25,25-50)が、私の範囲は65で上限があり、ディスプレイは40で上限があるようです。
これが私のロードモア機能で機能していません:
-(void) getNewRange{
int currentRange = [allItems count];
int newRange = currentRange + 25;
if(newRange > [xmlParser total]){
NSLog(@"evaluating as greater than the total, which is 837");
newRange = [xmlParser total];
}
NSString *range = [[NSString alloc] initWithFormat:@"?range=%d&range2=%d",currentRange,newRange];
NSString *newUrl =[[NSString alloc] initWithFormat:@"http://localhost/fetchAllTitles.php%@",range];
XMLParser *tempParser = [[XMLParser alloc] loadXMLByURL:newUrl];
[allItems addObjectsFromArray:[tempParser people]];
NSMutableArray *newCells = [[NSMutableArray alloc] initWithCapacity:25];
for(int i=currentRange;i<newRange;i++){
NSLog(@"%d",i);
NSIndexPath *indexpath=[NSIndexPath indexPathForRow:i inSection:0];
[newCells addObject:indexpath];
}
NSLog(@"%@",newUrl);
[self.tableView insertRowsAtIndexPaths:newCells withRowAnimation:UITableViewRowAnimationAutomatic];
}
近づいていますが、次の新しいエラーが発生します。
*** Assertion failure in -[_UITableViewUpdateSupport _computeRowUpdates], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableViewSupport.m:386