I have googled but not find out answer. So I need to ask.
I have one home screen. When User is logged in it will display one view as like bellow
Now When User logged out and visiting home page he will see above layout but without center boxed layout. If I set That layout hidden it is now displaying as follows.
我想将第三个布局移到上面一点以删除空白。
我使用故事板添加了约束。现在需要从编程中删除约束并添加一个约束,将布局设置为第一个布局以下。
正如@Henit 提到的,您也可以为约束设置 IBOutlet。
例如,
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *viewHeight;
所以现在,您可以像这样删除这个约束:
[myView removeConstraint: viewHeight];
或者,如果您想删除与您的视图相关的所有/多个约束,那么,
[myView removeConstraints: constraintsArrayHere]; // custom array of constraints references
[myView removeConstraints: [myView constraints]]; //all constraints
然后您可以使用相同的方式添加新的约束addConstraint
or addConstraints
method.
有关更多详细信息,请参阅 Apple 文档here. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/occ/instm/UIView/removeConstraint:
希望这可以帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)