나는 모든 tableview 셀에 UISwitchView를 가지고 있으며 셀의 재정렬을 허용하려고합니다. 문제는 테이블 뷰에서 setEditing = true를 설정하면 액세서리 (switchview)가 사라집니다. 둘 다 유지할 수있는 방법이 있습니까?setediting = tableview에서 true로 설정하면 셀 accessoryview가 사라 집니까?
편집
static NSString *CellIdentifier = @"Edit Sources Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
NSUInteger row = [indexPath row];
Source *source = [self.sources objectAtIndex:row];
cell.textLabel.text = source.name;
UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
switchView.tag = row;
cell.accessoryView = switchView;
[switchView setOn:source.switchedOn animated:NO];
[switchView addTarget:self action:@selector(switchChangedForSource:) forControlEvents: UIControlEventValueChanged] ;
일했습니다! 고맙습니다 – user1337645