我将 PureLayout 用于我的编程视图约束。我以为我正确设置了它们,尺寸,X 和 Y 已解决。但是,当我在 SE 和 7 Plus 上运行代码时,视图无法正确对齐。
这是代码片段:
if (shouldSetupConstraints) {
// bg
backgroundView.autoPinEdgesToSuperviewEdges()
// positions
emailTextField.autoPinEdge(toSuperviewEdge: .top, withInset: 170)
emailTextField.autoPinEdge(toSuperviewEdge: .left, withInset: 60)
passwordTextField.autoPinEdge(toSuperviewEdge: .top, withInset: 250)
passwordTextField.autoPinEdge(toSuperviewEdge: .left, withInset: 60)
loginButton.autoPinEdge(toSuperviewEdge: .top, withInset: 350)
loginButton.autoPinEdge(toSuperviewEdge: .left, withInset: 75)
recoverButton.autoPinEdge(toSuperviewEdge: .top, withInset: 410)
recoverButton.autoPinEdge(toSuperviewEdge: .left, withInset: 60)
// confirms setup is done
shouldSetupConstraints = false
}
我认为视网膜屏幕上的屏幕点是相同的,那么为什么这些数字会有差异呢?