2011-12-15 6 views

Répondre

2

Une façon de le faire est d'ajouter le UIStepper à chaque cellule comme dans tableView sous-vue: cellForRowIndexAtPath dans votre TableViewController. Par exemple:

- (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; 
} 

Cela ajoutera un stepper à la droite de chaque cellule de votre table.

+0

Cela ne fonctionne pas pour certaines tailles d'écran – DaynaJuliana

Questions connexes