Using two top constraint with various priority values
<p>I've got a pretty trivial case.
There is a Container (light gray color) that has a HeaderLabel (lines = 0) with 16px margins and View (blue color). </p>

<p>If there some value for HeaderLabel it should place above the View. </p>

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

<p>Else if we have no value for HeaderLabel it should disappear and View sticks to top of the Container.</p>

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

<p>I tried to create two View.Top constraint to HeaderLabel and Container (constant >= 0) with various priority. </p>

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

<p>And remove HeaderLabel in the code if there is no text value for it</p>

<pre><code>if (!text) {
    [headerLabel removeFromSuperview];
}
</code></pre>

<p>But it seems not working. It just shows the gap between top of the Container and View </p>

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

<p>How can I manage this case using IB? Or it should be solved by another way?</p>