gpt4 book ai didi

iOs:以编程方式更改 Swift 中 UILabel 的比例

转载 作者:行者123 更新时间:2023-11-28 06:50:33 24 4
gpt4 key购买 nike

我想以编程方式更改 UILabel 的比例,以便在设备(iPhone 4、5、6、iPad)之间进行调整,因为我不能在 StoryBoard 上:

enter image description here

    if DeviceType.IS_IPHONE_4_OR_LESS {
} else if DeviceType.IS_IPHONE_5 {
} else if DeviceType.IS_IPHONE_6 {
} else if DeviceType.IS_IPHONE_6P {
} else if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
}

最佳答案

乘数属性(比率)是只读的。您应该通过按 Installed 复选框旁边的 + 号在约束中添加对尺寸类别的支持。因此,您可以为不同的尺寸类别指定不同的约束条件。

enter image description here

关于iOs:以编程方式更改 Swift 中 UILabel 的比例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35040786/

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