I\'m developing an app for iOS and I\'m using the Storyboard with AutoLayout ON. One of my view controllers has a set of 4 buttons, and in certain circumstances i would like
Building off the answer provided by Deniz, here is a solution using constraints in Swift
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