给定以下布局:
我想知道是否可以在左侧垂直将 imageView
相对于右侧的视图中心, imageView
仍将在中心(左图),而不在顶部(右图)。
我尝试将 imageView
的顶部限制为上标签及其底部到下标签,但我无法以AutoLayout会尝试使用的方式进行SE。满足两者”。尝试更改任何优先级或将约束更改为不平等,仅使 imageView
上升或向下。
Given the layout below:

I wanted to know if it's possible to center vertically the ImageView
on the left in relation to the views on the right so that, if any of the labels grow, the ImageView
would still be on the center (left image) and not on top (right image).


I tried constraining the ImageView
's top to the upper label and its bottom to the lower label but I haven't been able to se in a way that autolayout would try to "satisfy both". Trying to change any priority or changing the constraint to a inequality only makes the ImageView
goes up or down.
发布评论
评论(1)
可以肯定的是,您真的是指垂直不是水平?
将您的两个标签嵌入垂直堆栈视图中,并约束以堆栈视图为中心的图像视图。
另外,对于更少的约束,
Pretty sure you really mean Vertically not Horizontally?
Embed your two labels into a Vertical stack view, and constrain the image view centered to the stack view.
Alternatively, for even fewer constraints needed...