ios - 添加约束以使图像成为屏幕尺寸的 1/4

标签 ios xcode swift autolayout

您好,对于 4 到 6 的每个 iPhone 尺寸,我正在尝试让 4 个矩形成为屏幕尺寸的 1/4。

我已经尝试添加约束并将矩形设置为等高,但仍然没有成功。

有没有简单的方法来设置这个?

谢谢

最佳答案

你必须给每一个矩形添加equal heights约束(从矩形到 View ,它有屏幕的精确高度),然后点击约束,并设置乘数到 1:4。

enter image description here

enter image description here

关于ios - 添加约束以使图像成为屏幕尺寸的 1/4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28341932/

相关文章:

用于开发的 Swift 包管理器

ios - 显示不正确值的自定义 UITableViewCell

iphone - 警告 : passing argument 1 of 'setOn:' makes integer from pointer without a cast

ios - 替换已弃用的 -sizeWithFont :constrainedToSize:lineBreakMode: in iOS 7?

ios - 在设备上记录数据并检索日志

ios - 使用 MKDirections 实例的计算方法

xcode - dyld : Library not loaded: @rpath/libswiftContacts. 动态库

ios - NSURL "missing argument for parameter in call" swift

ios - SourceKitService 消耗 CPU 并导致 Xcode 停止

ios - 如何更改 UILabel 中链接的颜色?