我的应用程序中有以下层次结构
- UIScrollView
- UIStackView
- UIView 1 // load with xib and added in arrangedSubviews
- UIScrollView 1.1 // horizontal scrolling, fixed height constraint 38
- UIView 1.2 // called it childView. has fixed height 0 (I load the view from xib and add it here dynamically and update its height)
- UIView 1.2.1 // called it New View
- UIView 2
- UIView 3
Run Code Online (Sandbox Code Playgroud)
所以我的问题是当我从xib加载一个视图并将其添加到UIView1.2
也增加了高度约束0到新添加的子视图的高度但是什么都不会发生.UIView1.2
高度没有预期更新.
self.constraintChildViewHeight.constant = 95;
[self layoutIfNeeded];
NewView *newView = (NewView …
Run Code Online (Sandbox Code Playgroud)