Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created April 24, 2019 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onmyway133/49474a384f3560b00c4be768a584222a to your computer and use it in GitHub Desktop.
Save onmyway133/49474a384f3560b00c4be768a584222a to your computer and use it in GitHub Desktop.
class ViewController: UIViewController {
let box = UIView()
override func viewDidLoad() {
super.viewDidLoad()
box.backgroundColor = UIColor.red
view.addSubview(box)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
box.frame = CGRect(x: 20, y: 50, width: view.frame.size.width - 40, height: 100)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment