Skip to content

Instantly share code, notes, and snippets.

@aniltv06
Created September 12, 2016 13:10
Show Gist options
  • Save aniltv06/d555446e15e2053274786765746b8f45 to your computer and use it in GitHub Desktop.
Save aniltv06/d555446e15e2053274786765746b8f45 to your computer and use it in GitHub Desktop.
Adding UILabel programatically in Swift 3
class ViewController: UIViewController {
var label : UILabel! = nil
override func viewDidLoad() {
super.viewDidLoad()
self.label = UILabel(frame: CGRect(x: 0, y: 0, width: 300, height: 21))
self.label.font = UIFont.preferredFont(forTextStyle: .footnote)
self.label.textColor = .black
self.label.center = CGPoint(x: 200, y: 300)
self.label.textAlignment = .center
self.label.text = "Demo Text UILabel"
self.logOutButton.isHidden = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment