美文网首页
tableView的重制cell的删除按钮自定义

tableView的重制cell的删除按钮自定义

作者: 夜未殇 | 来源:发表于2017-04-27 16:50 被阅读0次
Paste_Image.png
- (void)layoutSubviews {
    [super layoutSubviews];
    for (UIView *subView in self.subviews){
        if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
            CGRect cRect = subView.frame;
            cRect.size.height = self.contentView.frame.size.height - 10;
            cRect.origin.y = 10;
            subView.frame = cRect;
            
            UIView *confirmView=(UIView *)[subView.subviews firstObject];
            // 改背景颜色
            confirmView.backgroundColor=[UIColor colorWithRed:254/255.0 green:85/255.0 blue:46/255.0 alpha:1];
            for(UIView *sub in confirmView.subviews){
                if([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]){
                    UILabel *deleteLabel=(UILabel *)sub;
                    // 改删除按钮的字体
                    deleteLabel.font=[UIFont boldSystemFontOfSize:15];
                    // 改删除按钮的文字
                    deleteLabel.text=@"删除";
                }
            }
            break;
        }
    }
}

相关文章

网友评论

      本文标题:tableView的重制cell的删除按钮自定义

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