// 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;
}

最新文章

  1. github拉取和推送
  2. 常用shell
  3. JS学习笔记--轮播图效果
  4. js中特有语句-with
  5. paip.字符串操作uapi java php python总结..
  6. Android组件系列----ContentProvider内容提供者
  7. STL Iterators
  8. Spring入门学习(一)
  9. GridView控件显示图片
  10. http2.0 相对于 http1.1的优势
  11. 探索A@1db9742
  12. Arrays类与Array类探究
  13. mysql多实例-主从复制安装
  14. linux周期性计划任务 进程管理
  15. 我们知道CDN护航了双11十年,却不知道背后有那么多故事……
  16. .net core2 单元测试
  17. kubernetes集群搭建(7):常见问题及处理
  18. linux网关设置
  19. Python之路----内置函数补充与匿名函数
  20. 解决wamp、vertrigo等集成环境安装后apache不能启动的问题

热门文章

  1. Android 自定义View修炼-Android中常见的热门标签的流式布局的实现
  2. 通过代码创建label 计算最佳尺寸 让其自适应文本高度或宽度
  3. linux基于file的logger
  4. [Laravel]配置路由小记
  5. [转]分布式系统为什么需要 Tracing?
  6. 关于 I/O Wait
  7. mount命令详解
  8. 【MINA】用protobuf做编解码协议
  9. gwt-问题解决
  10. NPOI操作EXCEL 类代码