ios11前是可以在系统图层上修改删除按钮的,这个图层叫UITableViewCellDeleteConfirmationView,我们只需要把我们想要添加的删除的视图添加到这个图层上,就完工了
直接上代码
- (void)layoutSubviews{
[self modifiDeleteBtn];
}
-(void)modifiDeleteBtn{
for(UIView *subView in self.subviews) {
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
subView.backgroundColor=[UIColor whiteColor];
for(UIButton *btn in subView.subviews) {
btn.backgroundColor = [UIColor whiteColor];
if([btn isKindOfClass:[UIButtonclass]]) {
[btn addSubview:self.deleteLabl];
self.deleteLabl.frame = CGRectMake(2,15, CGRectGetWidth(btn.bounds)-4,93);
}
}
}
}
}