Robot Rocker
Robot Rocker

Reputation: 474

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.

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.

Upvotes: 0

Views: 1128

Answers (1)

CrimsonChris
CrimsonChris

Reputation: 4651

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?

Upvotes: 1

Related Questions