im trying to add a UIStepper programmatically, HEre is my code: the stepper wont show up. :
stepper = [[UIStepper alloc]init];
[stepper setFrame:CGRectMake(216, 91, 155, 25)];
[stepper setMinimumValue:0];
[cell addSubview:stepper];
Thank you!
CELLFORROWATINDEXPATH:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UIStepper * myStepper = [[UIStepper alloc]initWithFrame:CGRectMake(206,20,94,27)];
[myStepper setMinimumValue:0];
[cell addSubview:myStepper];
cellLabel = [[UILabel alloc]init];
[cellLabel setFrame:CGRectMake(65, 22, 27, 27)];
[cellLabel setText:@"1"];
[cell.contentView addSubview:cellLabel];
}
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
cell.imageView.image = [imageArray objectAtIndex:indexPath.row];
// cell.textLabel.text = [cells objectAtIndex:indexPath.row];
if ([cell.imageView.image isEqual:[UIImage imageNamed:@"paddle5.png"]]) {
[cellLabel setFrame:CGRectMake (175, 22, 30, 30)];
}
if ([cell.imageView.image isEqual:[UIImage imageNamed:@"paddle4.png"]]) {
[cellLabel setFrame:CGRectMake (150, 22, 30, 30)];
}
if ([cell.imageView.image isEqual:[UIImage imageNamed:@"paddle3.png"]]) {
[cellLabel setFrame:CGRectMake (120, 22, 30, 30)];
}
if ([cell.imageView.image isEqual:[UIImage imageNamed:@"paddle2.png"]]) {
[cellLabel setFrame:CGRectMake (90, 22, 30, 30)];
}
return cell;
}
the if
statements right above return cell;
is just to position a few labels i have on the cell.