O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding view controllers using container view

We will talk about something very simple in this section, but it has a high impact when working with storyboard and interface builder. In storyboard, you can create a container view, which acts as a holder or container for another view controller in your storyboard. You may ask why we need to do this when we can add the layout of this view controller just directly as a subview. The most benefit you can get out of this is when you have a view, which is reusable, in different locations in your app; you can create it in a different view controller and have it embedded whenever and wherever you want, without needing to duplicate any screen or any layout.

How to do it...

  1. Let's create a new Xcode project ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required