import UIKit
class ViewController: UIViewController,UITextFieldDelegate {
override func viewDidLoad() {
super.viewDidLoad()
//1、UILabel
let label = UILabel(frame:CGRect(x:20,y:20,width:self.view.bounds.size.width - 40,height:30))
label.text = "我是一个文本标签"
self.view.addSubview(label)
//字体设置:
label.font = UIFont.boldSystemFont(ofSize: 20)
//颜色设置:
label.textColor = UIColor.red
label.shadowColor = UIColor.gray
label.textAlignment = NSTextAlignment.center
label.backgroundColor = UIColor.init(red: 236/255.0, green: 236/255.0, blue: 236/255.0, alpha: 1)
let label1 = UILabel(frame:CGRect(x:20,y:50,width:label.bounds.size.width,height:40))
let attri = NSMutableAttributedString(string:"这是一个定制文本")
attri.addAttributes([NSFontAttributeName:UIFont.boldSystemFont(ofSize: 20),NSForegroundColorAttributeName:UIColor.blue], range: NSRange(location:0,length:4))
attri.addAttributes([NSFontAttributeName:UIFont.boldSystemFont(ofSize: 10),NSForegroundCol