swift-UILabel

 // Mark: 2. 创建label
private func creatLabel(title: NSString)->UILabel{
/// 创建label
let titleL = UILabel(frame: CGRectMake(, , , )) titleL.text = title as String
titleL.textColor = UIColor.redColor()
titleL.backgroundColor = UIColor.yellowColor()
titleL.layer.cornerRadius = 10.0
titleL.layer.masksToBounds = true
titleL.textAlignment = NSTextAlignment.Center
titleL.font = UIFont.systemFontOfSize(16.0)
// 阴影
titleL.shadowColor = UIColor.cyanColor()
titleL.shadowOffset = CGSizeMake(-, )
// 省略方式
titleL.lineBreakMode = NSLineBreakMode.ByTruncatingTail
// titleL.adjustsFontSizeToFitWidth = true
titleL.numberOfLines = // 富文本
let attr = NSMutableAttributedString(string: "NSMutableAttributedStringNSMutableAttributedStringNSMutableAttributedString") attr.addAttribute(NSFontAttributeName, value: UIFont.boldSystemFontOfSize(25.0), range: NSMakeRange(, ))
attr.addAttribute(NSForegroundColorAttributeName, value: UIColor.purpleColor(), range: NSMakeRange(, ))
titleL.attributedText = attr self.view.addSubview(titleL)
return titleL;
}
上一篇:Python多版本共存之pyenv


下一篇:Python多版本共存管理工具之pyenv