Modify AutoLayout Constraints

I have a problem when I want to change NSLayoutconstraints in a UIView, but it seems that many properties are readonly. First, I have four UIViews as squares in the form of a square representation, and they are all connected to each other with an interval of about 20 pixels.

I have a button that enlarges the frame of one of these squares in full screen, covering all the others. It was at this moment that I would like to change the limitations of this UIView to attach it to the borders of the superviews of 20 pixels, so when I rotate it, it does not return to the square view, but supports full screen. It looks like the property that I would like to change is "second", but that will not work. Am I approaching this problem wrong? I find Autolayout a bit difficult, so any help would be greatly appreciated.

+6
source share
1 answer

Hi, you can do 2 sets of restrictions:

  • 1 to control your High Priority Quad View
  • 1 to control low-priority full-screen mode

In the method that is called when your button is clicked, set the priority high for your restrictions in full screen mode and low priority according to the restrictions per square.

+9
source

Source: https://habr.com/ru/post/981344/


All Articles