只能自定义,自定义最好的办法就是把tableView中得cell设置为可编辑的,代码如下:
UITableViewCell *cell;
if (indexPath.section ==0) {
cell=[self.batteryAlertTableViewdequeueReusableCellWithIdentifier:@"ItemCell"];
if (cell ==nil) {
cell=[[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:@"ItemCell"];
}
NSMutableArray *tempobject=[[NSUserDefaultsstandardUserDefaults]objectForKey:@"batteryAlertMulti"];
for (NSObject *rowin tempobject)
{
NSNumber *tempNum = (NSNumber*) row;
int rownumber = [tempNum intValue];
NSInteger selectedIndex = rownumber;
NSIndexPath *selectedIndexPath = [NSIndexPathindexPathForRow:selectedIndex inSection:0];
[self.batteryAlertTableViewselectRowAtIndexPath:selectedIndexPathanimated:NOscrollPosition:UITableViewScrollPositionNone];
}
cell.textLabel.text = [self.dataArrayobjectAtIndex:indexPath.row];
cell.textLabel.textColor=[UIColorwhiteColor];
//[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
//去除cell在选中时的高亮白色
cell.selectedBackgroundView=[[UIViewalloc]initWithFrame:cell.frame];
cell.selectedBackgroundView.backgroundColor=[UIColorclearColor];
return cell;
}