How to adjust the size of a view at the top of UITableView programatically? : <p>I have a UITableVIew in my app with views holding content at the top and bottom. These obviously scroll out of frame when the user scrolls which is the desired behaviour. </p>

<p>Depending on user inputs I'd like to hide half of the topView but I can't edit the height of that view directly for some reason. I don't know why. I can drag it in Interface Builder but can't edit it programatically. The debugger tells me it's a read only value. </p>

<p>I can get half way there by editing the height of the inner view (statusView) but it then leaves a gap between the end of the topView and the table cells. </p>

<p>Any suggestions?</p>

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