ビューが読み込まれるときにUITableViewのすべてのセルを読み込んで、スクロールしているときに読み込まれないようにすることはできますか?(これを実行している間、ロード画面を表示します)
どうか、それが私のプロジェクトでの唯一の方法です(理由を説明するには複雑すぎて申し訳ありません^^)
編集:
さて、私があなたに説明させてください、私がしていることは間違いありません:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = [NSString stringWithFormat:@"Identifier %i/%i", indexPath.row, indexPath.section];
CustomTableCell *cell = (CustomTableCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
NSDictionary *currentReading;
if (cell == nil)
{
cell = [[[CustomTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
UILabel *label;
UIView *separator;
if(indexPath.row == 0)
{
// Here I'm creating the title bar of my "table" for each section
}
else
{
int iPr = 1;
do
{
currentReading = [listData objectAtIndex:iPr-1];
iPr++;
} while (![[currentReading valueForKey:@"DeviceNo"] isEqualToString:[devicesArr objectAtIndex:indexPath.section]] ||
[readingresultsArr containsObject:[currentReading valueForKey:@"ReadingResultId"]]);
[readingresultsArr addObject:[currentReading valueForKey:@"ReadingResultId"]];
//
// ...
//
}
}
return cell;
}
私のエラーはdo-while-loopで発生します:「listData」は複数の辞書を含む配列です。私の問題は、テーブルをゆっくりと下にスクロールしているときはすべて問題ないということですが、ビューの最後まですばやくスクロールしてから中央までスクロールすると、iPrが外れているというエラーが表示されます配列の範囲。したがって、問題は、最初のセクションの最後の行がすでに「readingresultsArr」に追加されているが、ロードされていないか、再度ロードしたいということです。これが、すべてのセルを一度にロードしたい理由です。