このコードを使用すると、詳細はステッパーが機能しません (ログで確認できます)
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier=@"CellIDD";
Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
Data *item = [self.data objectAtIndex:indexPath.row];
if (cell == nil)
{
cell = [[[Cell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryView = [self newStepper];
if (NSStringFromClass([UIStepper class]))
[(UIStepper *)cell.accessoryView setTag:indexPath.section * 100 + indexPath.row];
else
[(CustomStepper *)cell.accessoryView setTag:indexPath.section * 100 + indexPath.row];
}
if (NSStringFromClass([UIStepper class]))
{
[(UIStepper *)cell.accessoryView setMinimumValue:0];
[(UIStepper *)cell.accessoryView setMaximumValue:18];
[(UIStepper *)cell.accessoryView setValue:[[_values objectAtIndex:indexPath.row] intValue]];
}
else
{
[(CustomStepper *)cell.accessoryView setMinimumValue:0];
[(CustomStepper *)cell.accessoryView setMaximumValue:18];
[(CustomStepper *)cell.accessoryView setValue:[[_values objectAtIndex:indexPath.row] intValue]];
}
cell.cellTextLabel3.text = item.name;
cell.cellPriceLabel3.text = item.bounty;
cell.labelSnipper.text = [[_values objectAtIndex:indexPath.row] stringValue];
NSLog(@"VALUE %@",_values);
return cell;}
このコードを使用する場合、ステッパーが機能することを示すログのラベルが明確ではありません
NSString *cellID = [NSString stringWithFormat:@"CellID%d", indexPath.row];
Cell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
Data *item = [self.data objectAtIndex:indexPath.row];
if (cell == nil)
{
cell = [[[Cell3 alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryView = [self newStepper];
if (NSStringFromClass([UIStepper class]))
[(UIStepper *)cell.accessoryView setTag:indexPath.section * 100 + indexPath.row];
else
[(CustomStepper *)cell.accessoryView setTag:indexPath.section * 100 + indexPath.row];
}
if (NSStringFromClass([UIStepper class]))
{
[(UIStepper *)cell.accessoryView setMinimumValue:0];
[(UIStepper *)cell.accessoryView setMaximumValue:18];
[(UIStepper *)cell.accessoryView setValue:[[_values objectAtIndex:indexPath.row] intValue]];
}
else
{
[(CustomStepper *)cell.accessoryView setMinimumValue:0];
[(CustomStepper *)cell.accessoryView setMaximumValue:18];
[(CustomStepper *)cell.accessoryView setValue:[[_values objectAtIndex:indexPath.row] intValue]];
}
cell.cellTextLabel3.text = item.name;
cell.cellPriceLabel3.text = item.bounty;
cell.labelSnipper.text = [[_values objectAtIndex:indexPath.row] stringValue];
NSLog(@"VALUE %@",_values);
return cell;
}