Yes, you can do it with restrictions.
First you need to create restrictions for the supervisor, not for the closest view. Neighboring views will change, so we DO NOT want the restrictions to apply to other views. See the screenshot below for an example of how to set limits.

Then bind the constraints that you will change in IBOutlets so that we can modify them programmatically. For your example, these would be limitations:
@IBOutlet var greenViewTrailingConstraint: NSLayoutConstraint! @IBOutlet var greenViewBottomConstraint: NSLayoutConstraint! @IBOutlet var redViewTopConstraint: NSLayoutConstraint! @IBOutlet var redViewLeadingConstraint: NSLayoutConstraint! @IBOutlet var redViewBottomConstraint: NSLayoutConstraint! @IBOutlet var blueViewTrailingConstraint: NSLayoutConstraint! @IBOutlet var blueViewTopConstraint: NSLayoutConstraint! @IBOutlet var blueViewLeadingConstraint: NSLayoutConstraint!
Finally, update the constraint constants based on UIInterfaceOrientation. Again, using your example, the code looks something like this:
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) { let padding: CGFloat = 16.0
source share