To set text to label.
la.text = “This is
example text”
To color text.
la.textColor = UIColor.blueColor()
To change font, color,
text size.
let t="Text to change font"
let at=NSMutableAttributedString(string: t , attributes: [NSForegroundColorAttributeName: UIColor.blueColor(), NSFontAttributeName: UIFont(name: "Arial", size: 15.0)!])
la.attributedText(at, forState: .Normal)
To make bold text.
la.font = UIFont.boldSystemFontOfSize(17)
To make italic text.
la.font = UIFont.italicSystemFontOfSize(17)
To make text center.
la.textAlignment = NSTextAlignment.Center
To make label has many
lines and high enough.
la.numberOfLines = 0
la.sizeToFit()
To make border, color
border.
la.layer.borderColor = hex("#6699cc").CGColor
la.layer.borderWidth = 1
Function hex to use hex
code can see here.
No comments:
Post a Comment