gpt4 book ai didi

ios - 如何在 iPhone 6 plus 上放大布局

转载 作者:行者123 更新时间:2023-11-29 01:44:26 25 4
gpt4 key购买 nike

我在我的项目中启用了启动屏幕,但我发现登录 View 非常小,因为它仍在使用 iPhone 5 布局限制。有什么简单的方法可以放大 iPhone 6 plus 的 View 吗? enter image description here

最佳答案

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

https://github.com/cathyxchen/autoAutoLayout

示例

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

在那之后就放置

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

在您的 ViewController.m 中。 (我放在了viewDidLoad方法中)

现在,它根据 BaseModel(在我的 iPhone5 案例中)计算控件到所有其他 iPhone 显示屏尺寸的位置。

代码说明

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

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

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

这会调用方法来重新计算 BaseModel 中的新位置。

关于ios - 如何在 iPhone 6 plus 上放大布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32086412/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com