Hide autolayout UIView : How to get existing NSLayoutConstraint to update this one

后端 未结 2 1495
故里飘歌
故里飘歌 2020-11-30 11:35

I know how to modify a existing constraint. But I would to know if someone has found a solution to get a constraint without save this one as a property.

Current solu

2条回答
  •  死守一世寂寞
    2020-11-30 12:04

    I just built this Category (https://github.com/damienromito/UIView-UpdateAutoLayoutConstraints) that update constrains when you want:

    //you can use tools to hide/show a uiview
    [myView1 hideByHeight:YES];
    

    enter image description here

    Or just do it to hide an UIView with autolayout:

    //Hide View 
    [myView1 setConstraintConstant:0 forAttribute:NSLayoutAttributeHeight];
    

提交回复
热议问题