-
Notifications
You must be signed in to change notification settings - Fork 0
Label
Mohammad Azmal Hossain edited this page Jan 29, 2017
·
9 revisions
import UIKit
let greet = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 30)) // it also related with background color // always use let, not var // greet.frame = CGRect(x: 100, y: 50, width: view.frame.width - 200, height: 40) greet.center = CGPoint(x: 160, y: 284)
// greet.textColor = UIColor.cyan greet.textColor = .cyan self.view .addSubview(greet)
greet.textAlignment = .center greet.backgroundColor = UIColor .lightGray greet.text = "this is Label"
//you will probably want to set the font (remember to use Dynamic type!) greet.font = UIFont.preferredFont(forTextStyle: .footnote) // greet.font = UIFont(name: "MarkerFelt-Thin", size: 45)
greet.numberOfLines = 5 buttonOne.layer.borderWidth = 1; // let myColor = UIColor(red: 0.5, green:0.5, blue: 0, alpha: 1.0) // greet.layer.borderColor = myColor.cgColor greet.layer.borderColor = UIColor(red: 0.5, green:0.5, blue: 0, alpha: 1.0).cgColor greet.layer.cornerRadius = CGFloat(10)