Questions tagged [uicontainerview]

There is no public UIContainerView class in Cocoa Touch, but there is a pattern that uses a UIViewController as a container for one or more child view controllers. This pattern is also in the object library of Interface Builder in Xcode with the name Container View.

You can drag a Container View for the object library into a view in a Storyboard scene. This will create a new view in the scene and creates a new view controller object which is connected with the container view by a segue. The view of this new view controller is displayed in the connected view.

The class UIViewController supports nesting of child view controllers. The documentation contains also a section about Implementing a Container View Controller programmatically.

646 questions
207
votes
11 answers

Access Container View Controller from Parent iOS

in iOS6 I noticed the new Container View but am not quite sure how to access it's controller from the containing view. Scenario: I want to access the labels in Alert view controller from the view controller that houses the container view. There's a…
Adam Waite
  • 19,748
  • 19
  • 120
  • 146
120
votes
4 answers

How to add a Container View programmatically

A Container View can be easily added into a storyboard through Interface Editor. When added, a Container View is of a placeholder view, an embed segue, and a (child) view controller. However, I am not able to find a way to add a Container View…
Dante May Code
  • 10,578
  • 9
  • 46
  • 75
102
votes
3 answers

What does addChildViewController actually do?

I'm just dipping my feet for the first time into iOS development, and one of the first things I've had to do is implement a custom container view controller - lets call it SideBarViewController - that swaps out which of several possible child view…
Mark Amery
  • 110,735
  • 57
  • 354
  • 402
74
votes
5 answers

Sizing a Container View with a controller of dynamic size inside a scrollview

I'm trying to create a container view, with a controller that has a dynamic height, inside a UIScrollView and have it sized automatically using auto layout. View Controller A is the scrollview, which has the container view included, along with more…
58
votes
2 answers

How to add a subview that has its own UIViewController in Objective-C?

I am struggling with subviews that have their own UIViewControllers. I have a UIViewController with a view (light pink) and two buttons on a toolbar. I want blue view to display when the first button is pressed and the yellow view to display with…
Patricia
  • 4,809
  • 13
  • 59
  • 138
43
votes
2 answers

How do I get the views inside a container in Swift?

I have a Container View that I popped into my storyboard. There's a wonderful little arrow that represents the embed segue to another scene. That scene's top level object is controlled by a custom UIViewController. I want to call a method that's…
Evan Conrad
  • 1,969
  • 2
  • 21
  • 27
31
votes
8 answers

UITableView content overlaps Status Bar when UISearchBar is active

I have a UITableViewController with a UISearchBar and UISearchDisplayController. That exists inside a Container View in a UIViewController which is in a UINavigationController. I made this image to help describe the structure: This is what it…
27
votes
4 answers

Access container view child properties swift

What I want to achieve: User presses the button in the ViewController then, the color of the button placed in the container view should change its color to red. How can I get access of the button placed in the container view, from the…
Tom el Safadi
  • 4,029
  • 4
  • 28
  • 65
25
votes
3 answers

Swapping child views in a container view

Let ContainerView be the parent container view with two child content views: NavigationView and ContentView. I would like to be able to swap out the controller of ContentView with another view. For example, swapping a home page controller with a…
Alex
  • 1,183
  • 2
  • 16
  • 25
24
votes
2 answers

Add a ContainerView inside a UIViewController created from .xib

I have a .xib file and i want to add it a container view (to place inside a ViewController). Unfortunately a container view is only disposable by storyboard. But when i create a .xib file and i search for the container view controller, i don´t found…
Fahem Issameddine
  • 273
  • 1
  • 2
  • 9
16
votes
5 answers

UITableViewController refreshControl is glitchy when UITableViewController frame.height is small

I have a problem that stems from the fact that UITableViewController refreshControl is glitchy when the frame of the UITableViewController is below a certain height. As it stands, I have a UIViewController, and in it I have a ContainerView that…
David
  • 6,021
  • 8
  • 39
  • 85
16
votes
4 answers

Storyboards and custom container view controllers

I'm creating a custom container view as per the apple spec. I would like to use the storyboard to connect three static child UIViewControllers. Is there an easy way in the storyboard to connect via a Relationship as seen for the…
Stephen
  • 492
  • 5
  • 12
13
votes
7 answers

UIView-Encapsulated-Layout-Height and Container View

I have UIViewController 1 , that has scroll view. Inside this scrollview there is container view that pinned to top/bottom leading/trailing (without fixed height). Container view has UITableView pinned to top/bottom trailing/leading and height…
Serd
  • 391
  • 1
  • 3
  • 12
13
votes
6 answers

Perform a parent segue from the embedded view controller

I have this: MyTableViewController (inherits from UITableViewController) It has a dynamic tableview with a few cells (foo, bar, qux) MyViewController (inherits from UIViewController) There are some "show" segues from this controller to other…
sports
  • 6,889
  • 11
  • 61
  • 121
13
votes
2 answers

dispatch event to parent ViewController in swift

I'm coming from as AS3 background so it might be easier for me to show you what I'm trying to do with AS3. I have a UIViewController(root) and inside that I have a ContainerView. I am under the impression that the container view's UIViewController…
icekomo
  • 8,336
  • 7
  • 27
  • 53
1
2 3
43 44