1
我在UITableViewCells中有一些UISwitch。但是这个表格由多个部分组成。在向下滚动表格时,新创建的单元格有时会更新为不属于下划线部分的无效开关。交换机交换不是不可预测的顺序,它只是随机地向交换机添加交换机。然而,这是一个奇怪的情况。UITableViewCell中的UISwitch
这就是我所做的。
if(indexPath.section == 1){
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Text 1";
switch1 = [[UISwitch alloc] initWithFrame:CGRectZero];
cell.accessoryView = switch1;
[cell.contentView addSubview :switch1];
break;
case 1:
cell.textLabel.text = @"Text 2";
switch2 = [[UISwitch alloc] initWithFrame:CGRectZero];
cell.accessoryView = switch2;
[cell.contentView addSubview :switch2];
break;
case 2:
........
More sections
......
那么可能是什么问题呢?
谢谢。
你明白了吗? – GendoIkari 2010-12-02 20:53:08