Adding a container view to UICollectionViewCell

Loozie picture Loozie · Jan 13, 2015 · Viewed 7.7k times · Source

I am trying to add a container view to a UICollectionViewCell in interface builder but Xcode issues an error error: Illegal Configuration: Container Views cannot be placed in elements that are repeated at runtime. Will making the UICollectionViewCell static would solve this? If so, how would you make the UICollectionViewCell static?

Answer

Lolloz89 picture Lolloz89 · Jan 13, 2015

What I guess you are trying to do, is placing a UIViewController into a dynamically generated UITableViewCell. If so, this isn't possible if the cell you are generating are dynamic. If you know a priori that the cells will always be in a fixed number, you can generate them by Interface builder setting the cells to static.

If instead you only want to add a container view to your cell in order to put other objects in it, you need to add a UIView object, not a UIViewController.