I have used storyboard with autolayout for my UI design. Basically in android there are three different properties will be there like Visible, Invis
Neither removing the subview, nor adjusting the frame worked for me, so as an alternate solution, I programmatically added a constraint that automatically adjusts the difference.
For example: If you have 3 views, A_view B_view and C_view vertically aligned in that order and you want to "Hide" B and also adjust the difference, add a constraint
B_view.removeFromSuperView()
var constr = NSLayoutConstraint(item: C_view,
attribute: NSLayoutAttribute.Top,
relatedBy: NSLayoutRelation.Equal,
toItem: A_view,
attribute: NSLayoutAttribute.Bottom,
multiplier: 1,
constant: 20)
view.addConstraint(constr)
constant is (in this case) the amount of vertical space between C_view and A_view
It worked for me, but requires knowledge of constraints