セルを作成した後、セルのインデックスパスを取得するにはどうすればよいですか?uniqcell.tagを設定する必要があります。私がそれをどのように行うことができるか他のアイデアはありますか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForManagedObject:(NSManagedObject *)managedObject
{
ConditionCell *cell = (ConditionCell *)[tableView dequeueReusableCellWithIdentifier:[ConditionCell reuseIdentifier]];
if ( nil == cell )
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ConditionCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
} else
{
// Reset Image
cell.img.image = nil;
}
理由は、別のスレッドでセルを見つける必要があるためです
[condition processImageDataWithBlock:^(NSData *imageData) {
if (self.view.window) {
if (cell.tag == [self.tableView indexPathForCell:cell].row)
{
NSLog(@"%@",cell.tag);
UIImage *image = [UIImage imageWithData:imageData];
[condition writeToFile:imageData];
if (image)
{
cell.img.image = image;
[cell.activityIndicator stopAnimating];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[self.tableView indexPathForCell:cell]] withRowAnimation:UITableViewRowAnimationNone];
}
[condition release];
}
}
}];