@IBAction func Buttonclick_labelctrl (sender: anyobject) {
Define CGRect to initialize Uilable
var frame: cgrect = cgrect(x: , y: , Width: $ , Height: )
var label: UILabel = UILabel(frame:frame)
Get and set Font size adaptive properties (you can set fonts by Uifont)
var adjuststate: Bool = label. Adjustsfontsizetofitwidth
Label. Adjustsfontsizetofitwidth = false
Sets the number of rows to display, if set to 0, which means no limit (note the size of the cgrect that is used to create Uilabel)
Label. numberoflines = 0
Assign a value to a label
Label. text = "I am a dynamic label, this is a long string to test number of lines of label"+String (stringinterpolationsegment:adjuststate)
Set Font Color
Label. textcolor = uicolor. Redcolor()
Whether to highlight
Label. highlighted = true
Whether there is a text shadow
Label. Shadowcolor = uicolor. Greencolor()
self. View. Addsubview(label)
}
Simple ways to operate the "Swift" Uilabel