-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView* viewObj = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40];
UILabel *headerLabel = [[UILabel alloc] init];
headerLabel.font = [UIFont systemFontOfSize:14];
headerLabel.backgroundColor = [UIColor greenColor];
if(self.tableView.editing && section==0)
{
headerLabel.frame = CGRectMake(cellpositionX,0,self.tableView.bounds.size.width - cellpositionX,40);
NSString *NewSection = @"My new header message in edit mode d\n\n OK";
headerLabel.text = NewSection;
}
else {
headerLabel.frame = CGRectMake(0,0,self.tableView.bounds.size.width,40);
headerLabel.text = [self tableView:tableView titleForHeaderInSection:section];
}
[viewObj addSubview:headerLabel];
return viewObj;}
В приведенном выше коде вы можете передать значение x в ячейкуX.
Также каждый раз, когда TableView начинает и заканчивает редактирование.вам нужно перезагрузить TableView
Я надеюсь, что это решит вашу проблему