答案 0 :(得分:1)
当我遇到同样的问题时,我开始使用autoAutoLayout,效果很好。
https://github.com/cathyxchen/autoAutoLayout
示例强>
只需在Interface Builder中构建您的界面或以编程方式创建它。然后创建NO约束,只需将控件放在您想要的位置。
之后只是放置
[self.view removeConstraints:self.view.constraints];
[AutoAutoLayout layoutFromBaseModel:@"5" forSubviewsOf:self.view];
。 (我把它放在viewDidLoad方法中)
现在它根据BaseModel(在我的Case iPhone5中)计算控件在所有其他iPhone Display尺寸上的位置。
代码说明
[self.view removeConstraints:self.view.constraints];
这会删除所有约束,只是为了确保没有隐藏和监督的约束。
[AutoAutoLayout layoutFromBaseModel:@"5" forSubviewsOf:self.view];
这会调用Method从BaseModel重新计算新位置。
答案 1 :(得分:0)