- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 NSLayoutAnchor
设置乘数值?
例如 ,我们可以使用 NSLayoutConstraint 来做到这一点,乘数值为 1.5:
UIView *view1 = [[UIView alloc] init];
view1.translatesAutoresizingMaskIntoConstraints = false;
view1.backgroundColor = [UIColor redColor];
[self.view addSubview:view1];
NSLayoutConstraint *hConstraint = [NSLayoutConstraint constraintWithItem:view1
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1.5 constant:0.0f];
NSLayoutXAxisAnchor
时没有可用的乘数参数
hConstraint = [view1.centerYAnchor constraintEqualToAnchor:self.view.centerYAnchor constant:0.0f];
最佳答案
有两种变体 NSLayoutAnchor
接受乘数但仅在 NSLayoutDimension
上可用的方法 anchor (宽度和高度):
func constraint(equalTo anchor: NSLayoutDimension, multiplier m: CGFloat) -> NSLayoutConstraint
func constraint(equalTo anchor: NSLayoutDimension, multiplier m: CGFloat, constant c: CGFloat) -> NSLayoutConstraint
关于ios - NSLayoutAnchor - 设置 XAnchor/YAnchor 的乘数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41691833/
我正在使用 iPhone 6 Plus,并使用以下方法获取 UIView 的边界: let viewBounds = view.bounds // GIVES 736 x 414 (Points),
我正在尝试在 R 的 Quantstrat 包中运行回测策略。该工具是小麦 future ,以美分报价。合约规模为 5000 蒲式耳。因此,我添加了以下代码。 future(symbols,
我正在尝试在 R 的 Quantstrat 包中运行回测策略。该工具是小麦 future ,以美分报价。合约规模为 5000 蒲式耳。因此,我添加了以下代码。 future(symbols,
我是 JavaScript 新手。我想在 Javascript 中使用 prompt() 制作一个乘法器来获取数字 n,这是我们的乘法器,我想将从 1 到 n 的所有数字与 n 数字相乘。示例: 如果
TLDR:我正在寻找一种算法,它可以在知道以下情况的情况下返回可变数字数组的最小可能的最不常见乘数: 其中一个数字 我的数组的大小 数字可能的最小值和最大值 我正在使用音乐应用程序并遇到算法问题:当混
如何为 gluCylinder() 和 gluDisk() 等函数设置纹理坐标偏移和乘数? 因此,如果正常情况下纹理会从点 0 开始,我想将其设置为从点 0.6 或 3.2 等开始。乘数意味着纹理会变
我尝试向后移动文件中的位置,但仅当我移动 512 字节时它才有效,为什么? _file = CreateFile(path, GENERIC_WRITE | GE
我正在尝试以编程方式在 swift 中为乘数设置约束,当我设置值时,它只会给我错误,“无法分配给该表达式的结果”... 我用 IBOutlet 声明了 NSLayoutConstraint,然后设置乘
我是一名优秀的程序员,十分优秀!