Hi i am programmaticaly adding some views like this
let xPos = (self.view.frame.size.width - 200)/2
self.headerLabel = UILabel(frame: CGRect(x: xPos, y: 50.0, width: 200.0, height: 100.0))
self.shopButton = UIButton(frame: CGRect(x: xPos, y: 150.0, width: 200.0, height: 40.0))
self.createButton = UIButton(frame: CGRect(x: xPos, y: 230.0, width: 200.0, height: 40.0))
self.orLabel = UILabel(frame: CGRect(x: xPos, y: 200.0, width: 200.0, height: 20.0))
problem is when I rotate device to the landscape mode and vice versa my views are aligned to the left side. How can I prevent it?