Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 243
Joan Cardona Avatar asked Feb 08 '23 08:02

Joan Cardona


1 Answers

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)

like image 144
jungledev Avatar answered Feb 13 '23 07:02

jungledev