4

Am I the only one who can't find the Container View object in Xcode 7??

I used this feature before and now I want to implement it again an I can't find it.

I was wondering if maybe now is deprecated but it's still on Apple official documentation.

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

enter image description here

What I'm trying to do is to reproduce Snapchat navigation view, I'm having an scrollView with paging that will contain 3 View Controllers on each page. I want to use the container to add every child view controller.

Joan Cardona
  • 3,463
  • 2
  • 25
  • 43

1 Answers1

8

To echo the answer that user Raj Tandel posted in a comment, apparently you cannot use container views with xibs.

Here is a great thread that explains why:

It is not possible as it needs to deal with parent and child view relationship which is not meant for xib(s)

The solution is to "just add a plain UIView to the xib to act as a container. Then in code, add your child view controller's view as a subview of the container"

For further info, click the included link above (in an effort to keep good answers and threads continuous, rather than repeating what already exists)

Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
jungledev
  • 4,195
  • 1
  • 37
  • 52