私はこのtableViewを持っていて、カスタムの方法でセルを構築したいと考えています。私がそれを行う方法は、セルにサブビューを追加することです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(cell == nil)
{
cell=[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
}
else
{
UIImageView* img=[UIImage imageNamed:@"abc.png"];
[cell addSubview:img];
//processing the final cell takes time!
}
return cell;
}
ただし、不安定なフレーム レートがテーブルの応答性に影響を与えているため、このセルの作成をすべてスレッドに渡したいと思います。そのため、しばらくの間、ある種の画像を配置したいと思います。終了すると、スレッドはcell
最終的なセルに更新されます。
これは通常のアプローチですか?
もしそうなら、どうすればスレッドからセルを更新できますか?
すべての変数を __block として定義する必要がありますか? スレに入る前に?