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)中嘗試。它會幫助你。 –
請使用滾動視圖下的視圖以及該視圖中的所有其他對象。 –