zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    让linux下的eclipse支持GBK编码
    Ubuntu 14.04 安装深度音乐的方法(下载速度极慢未成功)
    wine使用
    Sql语句查看表结构
    读数据库所有表和表结构的sql语句
    详解软件工程之软工文档
    浅谈UML的概念和模型之UML九种图
    HTML5 file api读取文件的MD5码工具
    Sublime Text 3 快捷键汇总
    领域驱动设计系列文章汇总
  • 原文地址:https://www.cnblogs.com/blogfan/p/5846815.html
Copyright © 2011-2022 走看看