1
我有UIScrollview里面有动态视图(标签,Imageview)。我隐藏了一些意见,但白色的空白空间在那里。我怎样才能删除它?在滚动视图中隐藏视图后删除空白区域?
我试着用下面的代码,但它不工作,
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:myView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0]];
文件。类似的布局:
-View
-ScrollView
-UIImageView
-UIButton
-UIButton
-UILable
-UILable
-UIButton
-UILable
-UILable
可以提供任何截图删除不需要的滚动视图的看法? –
使用此[layoutsubviews](https://developer.apple.com/documentation/uikit/uiview/1622482-layoutsubviews),并在此方法中更改您的约束。如果没有帮助,请在[layoutIfNeeded](https://developer.apple.com/documentation/uikit/uiview/1622507-layoutifneeded)中尝试。它会帮助你。 –
请使用滚动视图下的视图以及该视图中的所有其他对象。 –