If you use restrictions, then you should use restrictions to resize the UITextView. Configure the outputs at the tip to access the restrictions you need to change from your code. You can set a constant constraint in real time, and this is usually enough.
Just to find out the reasons for this: you cannot change the view frame if it is placed by restrictions. Well, you can, but it's futile, and it's bad practice. This is because the limitations themselves will be used by the layout system to change the viewing frame for you! Thus, you can change the frame, but the layout system will read and allow restrictions and change the frame back.
Think of restrictions as a βto-do listβ for a layout system. Constraints do nothing on their own; this is just a list of rules. It is the layout system that does the work (when layoutSubviews is layoutSubviews ). Each time a layout is needed, the layout system comes in, reads the constraints, works on how to obey them, and does this - by setting the frames of your views. You need to work with this system, not against it.
source share