2011-12-15 53 views

回答

2

一做就是给UIStepper添加到每个细胞中的tableView一个子视图方式:cellForRowIndexAtPath在TableViewController。例如:

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

这将在您的表格的每个单元格的右侧添加一个步进器。

+0

这对某些屏幕尺寸不起作用 – DaynaJuliana 2015-03-26 02:25:41

相关问题