当我使用此代码时,但详细信息是步进器不起作用(可以在日志中看到)
(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;
}