如何在iPhone 6 plus上扩展布局

时间:2015-08-19 04:10:15

标签: ios objective-c xcode iphone-6-plus

我已在项目中启用了启动画面,但我发现登录视图非常小,因为它仍在使用iPhone 5布局限制。有没有简单的方法来扩展iPhone 6 plus上的视图? enter image description here

2 个答案:

答案 0 :(得分:1)

当我遇到同样的问题时,我开始使用autoAutoLayout,效果很好。

https://github.com/cathyxchen/autoAutoLayout

示例

只需在Interface Builder中构建您的界面或以编程方式创建它。然后创建NO约束,只需将控件放在您想要的位置。

之后只是放置

[self.view removeConstraints:self.view.constraints]; [AutoAutoLayout layoutFromBaseModel:@"5" forSubviewsOf:self.view];

在ViewController.m中

。 (我把它放在viewDidLoad方法中)

现在它根据BaseModel(在我的Case iPhone5中)计算控件在所有其他iPhone Display尺寸上的位置。

代码说明

[self.view removeConstraints:self.view.constraints];

这会删除所有约束,只是为了确保没有隐藏和监督的约束。

[AutoAutoLayout layoutFromBaseModel:@"5" forSubviewsOf:self.view];

这会调用Method从BaseModel重新计算新位置。

答案 1 :(得分:0)