iOS cell 左滑返回 定制返回按钮

在定制的cell类里面写如下代码

  • (void)layoutSubviews {
    [super layoutSubviews];
    for (UIView *subView in self.subviews){
    if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
    UIView *confirmView=(UIView *)[subView.subviews firstObject];
    // 改背景颜色
    confirmView.backgroundColor = GLCOLORBOTTOM;
    if([confirmView isKindOfClass:NSClassFromString(@"UIButton")]){
    UIButton *deletebtn=(UIButton *)confirmView;
    // 改删除按钮
    [deletebtn setImage:[UIImage imageNamed:@"icon_delete_round"] forState:UIControlStateNormal];
    [deletebtn setTitle:nil forState:UIControlStateNormal];
    }
    break;
    }
    }

}

样式如下

iOS cell 左滑返回 定制返回按钮_第1张图片
IMG_1576.PNG

你可能感兴趣的:(iOS cell 左滑返回 定制返回按钮)