0

次の行が原因で、スクロールダウンの問題がぎくしゃくしています。

NSString *text =[NSString stringWithCString:[[Text objectAtIndex:indexPath.row] cStringUsingEncoding:NSISOLatin1StringEncoding] encoding:NSUTF8StringEncoding];

テキストの長さはセル行ごとに異なります。私はこの行を持っています:

- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

この問題を克服する方法はありますか? どんな助けでも感謝します。

4

2 に答える 2

0

わかりました、私は自分の問題をかなりの時間検索していましたが、すべての uitableviewcells を事前計算して nsmutablearray に保存する必要があることがわかりました。高さは静的ではなく動的であるため、セルの高さも事前に計算する必要がありました。すべての計算を行った後、この行を

- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
             return [self.CellObjects objectAtIndex:indexPath.row]; //this just loads the precomputed cell
}

また、このように各セルの高さを追加する必要がありました

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{

  NSNumber *height=[HeightObjects objectAtIndex:indexPath.row];
    CGFloat height1=[height floatValue];
    return height1;

}

それが誰かを助けることを願っています!

于 2012-10-01T18:30:59.067 に答える