how do I add a UIStepper to every cell of my UITableView programmatically?
Thanks
Luca
how do I add a UIStepper to every cell of my UITableView programmatically?
Thanks
Luca
One way to do it is to add the UIStepper to each cell as a subview in tableView:cellForRowIndexAtPath in your TableViewController. For example:
- (UITableViewCell*) tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* CellIdentifier = @"Cell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
UIStepper* stepper = [[UIStepper alloc] init];
stepper.frame = CGRectMake(220, 10, 100, 10);
[cell.contentView addSubview: stepper];
}
return cell;
}
This will add a stepper to the right-hand side of each cell in your table.