如何修复 iOS 故事板中的不等式约束歧义? [英] How to fix inequality constraint ambiguity in iOS storyboard?

查看:33
本文介绍了如何修复 iOS 故事板中的不等式约束歧义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我当前视图控制器的屏幕截图.

Below is a screenshot of my current view controller.

我目前试图解决的问题是容器视图文本被固定在 UIView 的顶部.

The problem I'm trying to solve is currently the container view text gets pinned to the top of that UIView.

我以这种方式设置它,以便在较小的设备上它具有滚动视图,这样对我来说最容易可视化和布局元素.

I have it setup this way to on smaller devices it has a scroll view and this way it's easiest for me to visualize and layout the elements.

所以我的目标是在 UIView/容器视图(左侧)上设置最大高度,使其最大高度为 190 像素(因为这是内容的最高高度).

So my goal is to set a max height on that UIView/container view (on the left) to have a max height of 190px (since that is the tallest the content will ever be).

我尝试了上面的解决方案,但它给了我一个错误,说inquality constraint ambiguity.

I tried the above solution but it gives me an error saying inequality constraint ambiguity.

我的目标是最大高度为 190 像素,并在水平和垂直方向上居中查看.

My goal is to just have a max height of 190px and center that view horizontally and vertically.

我怎样才能做到这一点?

How can I achieve this?

编辑

更改底部空间以管理对 = 而不是 >= 的订阅会产生以下结果.

Changing bottom space to manage subscription to = instead of >= produces the following.

推荐答案

您可以通过在高度 = 190 的视图上放置一个低优先级的高度约束来解决这个歧义.

You can fix this ambiguity by placing a low priority height constraint on the View with the height = 190.

这将充当占位符高度约束,可以随时被更高优先级的 <= 190 约束覆盖.

This will act as a placeholder height constraint which can be overriden by the higher priority <= 190 constraint anytime.

这篇关于如何修复 iOS 故事板中的不等式约束歧义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆