美文网首页
ios11前修改系统自带的滑动删除按钮

ios11前修改系统自带的滑动删除按钮

作者: TaosionWei | 来源:发表于2017-10-31 10:37 被阅读0次

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);

}

}

}

}

}

相关文章

网友评论

      本文标题:ios11前修改系统自带的滑动删除按钮

      本文链接:https://www.haomeiwen.com/subject/cxmtrxtx.html