何か面白いことが起こっています。テーブルビューは、APIを介してflickrの写真を読み込みます。ビューをロードすると、名前とphotoURL配列が作成されます。次に、cFRAIP tableviewメソッドで、それらを使用してセルの値を設定します。
私はGCDで遊んでみることにし、これで終わりました:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell Identifier"] autorelease];
cell.textLabel.text = [photoNames objectAtIndex:indexPath.row];
dispatch_async(kfetchQueue, ^{
NSData *imageData = [NSData dataWithContentsOfURL:[photoURLs objectAtIndex:indexPath.row]];
cell.imageView.image = [UIImage imageWithData:imageData];
});
return cell;}
しかし、私が得たのは、写真のない各セルの写真名を含むテーブルビューです。写真は、セルをタップしたときにのみ読み込まれます。なぜこうなった?