If it is Viewcontrol, the AutoLayout adaptation is written in the -(void) Updateviewconstraints method to modify the constraint;
If the view is autolayout fit in -(void" in the Updateconstraints method.
You can simply drag a view constraint as a drag control into a property directly in the following method to change the
//traverse self. MyView the constraints in the control, locate the Nslayoutattributeheight control height constraint, and then modify the
-(void) updateviewconstraints
{
[Superupdateviewconstraints];
Nsarray *constrains = self . MyView. constraints;
For (nslayoutconstraint *constraint inconstrains) {
if (constraint. FirstAttribute = =nslayoutattributeheight) {
Constraint. constant = 50.0;
}
}
}
Note: Be sure to add the words "Super Updateviewconstraints" to the method. Otherwise it will be an error
After IOS adds AutoLayout in Xib or storyboard, modify the AutoLayout constraint in your code