Joan Cardona
Joan Cardona

Reputation: 3691

Can't find Container View Object

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.

Upvotes: 4

Views: 3460

Answers (1)

jungledev
jungledev

Reputation: 4345

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)

Upvotes: 8

Related Questions