zoukankan      html  css  js  c++  java
  • 改变滑动删除按钮样式

    在自定义 cell 中实现如下代码:

    // 改变滑动删除按钮样式

    - (void)layoutSubviews {

        [super layoutSubviews];

            for (UIView *subView in self.subviews){

                if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {

                    CGRect cRect = subView.frame;

                    cRect.origin.y = 10;

                    cRect.size.height = self.contentView.frame.size.height - 20;

                    subView.frame = cRect;

                    

                    // 设置部分圆角(左上与左下)

                    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:subView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerTopLeft cornerRadii:CGSizeMake(12,12)];

                    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

                    maskLayer.frame = subView.bounds;

                    maskLayer.path = maskPath.CGPath;

                    subView.layer.mask = maskLayer;

                    

                    UIView *confirmView=(UIView *)[subView.subviews firstObject];

                    // 改背景颜色

                    confirmView.backgroundColor=[UIColor redColor];

                    for(UIView *sub in confirmView.subviews){

                        if([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]){

                            UILabel *deleteLabel=(UILabel *)sub;

                            // 改删除按钮的字体

                            deleteLabel.font=[UIFont boldSystemFontOfSize:15];

                       

                            // 改删除按钮的文字

                            deleteLabel.text=@"删除";

                            }

                        }

                    

                    break;

                }

            }

        

    }

  • 相关阅读:
    c++ accumulate
    Croc Champ 2013 Round 2 (Div. 2 Edition) B. Ksusha the Squirrel
    ural 1017. Staircases
    ural 1012Kbased Numbers. Version 2 1013. Kbased Numbers. Version 3
    ural 1008. Image Encoding
    ural 1009. Kbased Numbers
    echo命令去掉换行符
    linux中shell 参数变量
    C#中可变字符串StringBuilder和String
    C#异常处理语句
  • 原文地址:https://www.cnblogs.com/zhufengshibei/p/7474477.html
Copyright © 2011-2022 走看看