[英]How do I make a UICollectionView fill it's superview with autosizing?
I have a UICollectionView with a dynamic size (variable amounts of data get added after it is added to the view) within a container view and I can't figure out how to get it to fill it's superview using autoresizing. 我在容器视图中有一个具有动态大小(添加到视图后会添加可变数量的数据)的UICollectionView,但我不知道如何使用自动调整大小来填充它来填充它的超级视图。
I have tried every combination of autoresizing masks (via xib and code for sanity) and nothing has worked. 我尝试过自动调整大小的蒙版的每种组合(通过xib和理智的代码),但没有任何效果。 I have also verified that it's superview has autosize subviews.
我还验证了它的超级视图具有自动调整大小的子视图。
Edit: It's not sizing to it's content either, the current behavior is that it is just staying at the size specified in the xib. 编辑:也不调整其内容的大小,当前的行为是它保持在xib中指定的大小。
Sounds like you might be confusing autoresizing masks with auto layout. 听起来您可能将自动调整蒙版与自动布局混淆了。 Autoresizing masks tell a view how to update its frame when its superview's frame changes.
自动调整大小的遮罩可告诉视图当其超级视图的帧发生更改时如何更新其帧。 It does not tell how to lay itself out initially.
它没有告诉我们最初如何布置自己。 Try setting your collection view's size to the size of its content view.
尝试将集合视图的大小设置为其内容视图的大小。
xcode/iOS: Autoresize to fill a view - explicit frame size is essential? xcode / iOS:自动调整大小以填充视图-显式的框架大小至关重要吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.