Post

Replies

Boosts

Views

Activity

Constraints misplaced
I have started a new app - I am new to this. I am going through a tutorial and came to the constraints section. I placed some constraints and then delete them because the elements were off. I placed two elements - a button and a label. @IBOutlet weak var middleLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. view.backgroundColor = .green middleLabel.text = "Hello There!" } @IBAction func buttonTaped(_ sender: Any) { view.backgroundColor = .blue middleLabel.text = "Changed Text" } But the elements are placed in the center of the storyboard but on running it, the label is on the top and button is not there. How do I re-apply the elements to center them on all iphones ? XCode 11.3.1 on macOS Mojave https://imgur.com/a/bmQY0iZ
1
0
452
Aug ’21