zoukankan      html  css  js  c++  java
  • swift-UILabel

     1 // Mark: 2. 创建label
     2     private func creatLabel(title: NSString)->UILabel{
     3                 /// 创建label
     4         let titleL = UILabel(frame: CGRectMake(100, 64, 200, 60))
     5         
     6         titleL.text = title as String
     7         titleL.textColor = UIColor.redColor()
     8         titleL.backgroundColor = UIColor.yellowColor()
     9         titleL.layer.cornerRadius = 10.0
    10         titleL.layer.masksToBounds = true
    11         titleL.textAlignment = NSTextAlignment.Center
    12         titleL.font = UIFont.systemFontOfSize(16.0)
    13         // 阴影
    14         titleL.shadowColor = UIColor.cyanColor()
    15         titleL.shadowOffset = CGSizeMake(-2, 2)
    16         // 省略方式
    17         titleL.lineBreakMode = NSLineBreakMode.ByTruncatingTail
    18 //        titleL.adjustsFontSizeToFitWidth = true
    19         titleL.numberOfLines = 2
    20         
    21         // 富文本
    22         let attr = NSMutableAttributedString(string: "NSMutableAttributedStringNSMutableAttributedStringNSMutableAttributedString")
    23         
    24         attr.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(25.0), range: NSMakeRange(0, 6))
    25         attr.addAttribute(NSForegroundColorAttributeName, value: UIColor.purpleColor(), range: NSMakeRange(7, 15))
    26         titleL.attributedText = attr
    27         
    28         self.view.addSubview(titleL)
    29         return titleL;
    30     }
  • 相关阅读:
    【转】杭电ACM试题分类
    python strip()函数介绍
    正则表达式的语法规则
    POSIX扩展正则表达式函数
    JS学习笔记
    PCRE兼容正则表达式函数
    vs 2008 feature pack 之体验
    #单元测试
    300道四则运算题
    观后感
  • 原文地址:https://www.cnblogs.com/guangleijia/p/5498319.html
Copyright © 2011-2022 走看看