Center UIView without overlapping neighbors views of different size?
<p>What I wish to achieve, the three of them are UILabels:</p>

<p><a href="https://i.stack.imgur.com/zZhSp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zZhSp.png" alt="enter image description here"></a></p>

<p><strong>Spec:</strong></p>

<ol>
<li><code>left</code> and <code>right</code> are edged UIViews.</li>
<li><code>middle</code> is centered, even though side views are not the same size.</li>
<li>On collision between <code>middle</code> and <code>left</code> or <code>middle</code> and <code>right</code>, the text in <code>middle</code> gets tail truncated while <code>left</code> and <code>right</code> do not change.</li>
</ol>

<p><strong>Problem:</strong></p>

<p>I cannot have meet both requirements (2) and (3) at the same time.</p>

<ul>
<li>(2) is achieved with <code>middle.autoAlignAxisToSuperviewAxis(.Vertical)</code>

<ul>
<li>problem: no truncate, it just overlaps <code>leftLabel</code> and <code>rightLabel</code>.</li>
</ul></li>
<li>(3) is achieved with <code>middle.autoPinEdge(.Left, toEdge: .Right, ofView: leftLabel)</code> and same strategy for the <code>rightLabel</code>.

<ul>
<li>problem: <code>middle</code> is centered in the area between <code>leftLabel</code> and <code>rightLabel</code>, if the last two do not have the same size, <code>middle</code> is not superview centered anymore.</li>
</ul></li>
</ul>

<p>Both applied create a constraint conflict and I don't know how to fix it, hence my question:</p>

<p>How can I center a UILabel and truncate it to avoir overlaps with side views of different sizes?</p>