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.

I have tried every combination of autoresizing masks (via xib and code for sanity) and nothing has worked. 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.

有帮助吗?

解决方案

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?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top