• iOS设置控件圆角,和label的行距。


    1. 设置控件圆角

         UIView *nameBgView = (UIView *)[PublicMethods creatViewWithType:@"UIView" andParent:name           andTag:kDrawCarTabelNameHeadBgViewTag];
                [nameBgView setFrame:CGRectMake(kDrawCarTableContentLabelXMargin, 30, name.frame.size.width-kDrawCarTableContentLabelXMargin*2, 50)];
                nameBgView.backgroundColor = [UIColor colorWithHex:0x43019d alpha:1];
                
                
                UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRoundedRect:nameBgView.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(5, 5)];
                
                CAShapeLayer *maskLayer = [CAShapeLayer layer];
                maskLayer.frame =nameBgView.bounds;
                maskLayer.path = bezierPath.CGPath;
                nameBgView.layer.mask = maskLayer;
                

    2. 设置label行距

    NSString *text = @"wnklsaxknsalkxnaslxnaklxaslxamxlakxnaskxnaskxnankxnaskxnaslkx";

    UILabel *contentLabel = [[UILabel alloc] init];

     NSMutableAttributedString *attStrSupplier = [[NSMutableAttributedString alloc]initWithString:text];
                //创建NSMutableParagraphStyle实例
                NSMutableParagraphStyle *styleSupplier = [[NSMutableParagraphStyle alloc]init];
                //设置行距
                [styleSupplier setLineSpacing:10.0f];
           
                [attStrSupplier addAttribute:NSParagraphStyleAttributeName value:styleSupplier range:NSMakeRange(0,text.length)];
         
                contentLabel.attributedText =attStrSupplier;

  • 相关阅读:
    Zuul token FIlter 验证失败结果输出
    springboot 使用 dev tool 导致 CastException
    索引失效的情况汇总
    JVM笔记-GC常用参数设置
    关于gdb和shp的FID问题
    配置mac百度云同步盘
    【python常用函数1】
    【python环境配置1】 环境变量与常用模块
    【nodejs笔记——小知识点汇总】
    ArcGIS标注
  • 原文地址:https://www.cnblogs.com/blogfan/p/5846815.html
Copyright © 2020-2023  润新知