-(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;}
在上面的代码可以传递在cellpositionX的x值。
每次当TableView开始和结束编辑。你需要重新加载的TableView
我希望这将解决您的问题
使用笔尖这样是不是很高性能 - 加载它们是出了名的慢。 – memmons 2010-12-05 00:11:15