How to programmatically change constraint constants?
<p>I read related questions(with nearly same titles), but it's not my case. I have a MKMapView and in the bottom of the screen i have ScrollView and ImageView. They are hidden, but when i show them i want to change bottom constraint of my MapView. The problem is, when i update bottom constraint, my MapView ignores it - i made ScrollView and ImageView transparent to check it - and even scrolls up, i don't understand why. My code for updating constant is this:</p>

<pre><code>bt.flyImg.isHidden = true
bt.mapBottom.constant -= bt.flyImg.height
bt.view.layoutIfNeeded()


bt.flyImg.isHidden = false
bt.mapBottom.constant += bt.flyImg.height
bt.view.layoutIfNeeded()
</code></pre>

<p>I checked the constraint, it's the constraint i need. I tried to write something like</p>

<pre><code>func layout()
    {
        self.view.layoutIfNeeded()
    }
</code></pre>

<p>because i thought it might happen because i tried to update constant from other class, but it didn't help. What am i doing wrong? </p>