我是用的xib拉的自定义cell,在cell的.m文件中加入
-(void)layoutSubviews
{
[super layoutSubviews];
for (UIView *subView in self.subviews)
{
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")])
{
UIView *confirmView=(UIView *)[subView.subviews firstObject];
for(UIView *sub in confirmView.subviews)
{
//修改字的大小、颜色,这个方法可以修改文字样式
//
if ([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]) {
UILabel *deleteLabel=(UILabel *)sub;
deleteLabel.backgroundColor = [UIColor redColor];
deleteLabel.font=[UIFont boldSystemFontOfSize:20];
//改删除按钮的文字
deleteLabel.text=@"";
//
}
//添加图片
//
if ([sub isKindOfClass:NSClassFromString(@"UIView")]) {
UIView *deleteView = sub;
UIView*fushi=deleteView.superview;
UIColor*tabcolor=COLOR_WITH_HEX(0xedf1f8);
fushi.backgroundColor=[UIColor redColor];
UIImageView *imageView = [[UIImageView alloc] init];
imageView.image = [UIImage imageNamed:@"中原地产CRM-14-消息工单_11.png"];
imageView.frame = CGRectMake((fushi.frame.size.width-ScreenWidth*93/1242)/2, (fushi.frame.size.height-ScreenHeight*93/2208)/2, ScreenWidth*93/1242, ScreenHeight*93/2208);
[fushi addSubview:imageView];
}
}
break;
}
}
}
要是字没除赶紧,那就在tableview添加的那个类实现协议方法
-(NSString*)tableView:(UITableView*)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath*)indexpath {
return @" ";
}
希望能帮到你们!