// Created by Catherine on 2017/8/28.
// Copyright © 2017年 Catherine. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let label : UILabel = UILabel(frame: CGRect(x: 120, y: 100, width: 200, height: 300))
//设置label上的文字
label.text = "I am a label"
//设置字体
label.font = UIFont.boldSystemFont(ofSize: 19)
//设置字体的颜色
label.textColor = UIColor.blue
//label.textColor = UIColor(colorLiteralRed: <#T##Float#>, green: <#T##Float#>, blue: <#T##Float#>, alpha: <#T##Float#>)
//alpha是透明度
//设置label的背景颜色
label.backgroundColor = UIColor.magenta
//设置文字的对齐方式
label.textAlignment = NSTextAlignment.center
//设置label的阴影
label.shadowColor = UIColor.orange
//设置阴影的偏移范围 (width向右偏移 height向下移动)
label.shadowOffset = CGSize(width: 30, height: 10)
//设置label的行数 =0 是无限行展示
label.numberOfLines = 2
self.view.addSubview(label)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}