我有两种看法:toastView和view。toastView是 的子视图view。我想toastView在 y 轴上定位view高度的 80%。如何在代码中使用常量来做到这一点?
我假设有一个类似的方法:
[toastView.topAnchor constraintEqualToAnchor:view.heightAnchor multiplier:0.8].active = YES;
Run Code Online (Sandbox Code Playgroud)
但我不能混合NSLayoutDimension(宽度和高度)和NSLayoutYAxisAnchor(X 和 Y)
这就是它在设计中的样子:
