你好我programmaticaly加入這樣問題與計劃增加的視圖
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))
問題的一些看法是,當我旋轉裝置,景觀模式,反之亦然我的看法是一致的左側。我怎樣才能防止它?
你可以找到一些好的文檔/後有:http://stackoverflow.com/questions/27473810/how-to-change-layout-constraints-programmatically-on -display-rotation和https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraintsinInterfaceBuidler.html – Balanced