childViewController is Apple's iOS Custom Container View Controller management style. Specifically the -addChildViewController: method facilitates Apple's iOS in order to combine multiple view controllers in a custom hierarchy (similar in concept to the UISplitViewController class)
Questions tagged [childviewcontroller]
242 questions
144
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
- 11,177
- 9
- 49
- 81
31
votes
3 answers
Add a child view controller's view to a subview of the parent view controller
I want to add a tableViewController as a child view controller of a containerViewController (shown below). According to Apple's View Controller Programming Guide I can achieve this by the following lines of code inside my containerViewController:
…

Mischa
- 15,816
- 8
- 59
- 117
26
votes
3 answers
Child View Controller to Rotate While Parent View Controller Does Not
What I am Trying to Do:
Parent View that is managed by Parent View Controller SHOULD NOT ROTATE.
Child View that is managed by Child View Controller SHOULD ROTATE to all orientations.
What I Have Tried:
ParentViewController
override func…

Gizmodo
- 3,151
- 7
- 45
- 92
20
votes
3 answers
Add child view controller to UINavigationController
I'm trying to add a child view controller to a UIViewController contained in a UINavigationController with this code:
- (void)buttonTapped:(id)sender
{
MyChildController *viewController = [self.storyboard…

Fred Collins
- 5,004
- 14
- 62
- 111
19
votes
3 answers
Child ViewController safe area inset doesn't update if partially offscreen
I am having difficulty with the Safe Area when sliding a child ViewController around on an iPhone X in landscape.
I have a root ViewController, and one of its views is moveable and contains an embedded child ViewController. The real app is a…

Ben
- 1,881
- 17
- 20
12
votes
5 answers
How to pass data from child to parent view controller? in swift
I created an activity where when one of the text fields clicked it will pop up a child(alert dialog) with list of product but when i click one item on the list I can't display it on the text filed once the alert dismissed.
this is the parent…

Joseph Vincent Magtalas
- 179
- 1
- 3
- 13
11
votes
2 answers
How to remove SFSafariViewController as a child view controller correctly?
I am using the technique provided by this SO answer to preload some URL in SFSafariViewController like this:
addChildViewController(svc)
svc.didMoveToParentViewController(self)
view.addSubview(svc.view)
And I try to remove the Safari View…

Joe Huang
- 6,296
- 7
- 48
- 81
11
votes
1 answer
In iOS, using storyboard, how to setup a view controller inside a container view?
I have created and drawn out a custom UIViewController called AutocompleteVC in my Main storyboard. AutocompleteVC will be used in several different places/storyboards and with different dimensions.
For example, in my Transit storyboard, shown…

abc123
- 8,043
- 7
- 49
- 80
9
votes
2 answers
Adding Child View Controller view to dynamic UITableViewCell
How can I add a view of a child view controller to a custom UITableViewCell? I can add the view like this inside…

Tometoyou
- 7,792
- 12
- 62
- 108
9
votes
7 answers
iOS routing viewDidAppear to child view controllers?
I'm adding a child view controller to a parent view controller, and everything works as expected, except that child view controller isn't having its usual callbacks triggered. eg, things like viewWillAppear(animated) is never called. I looked into…

pachun
- 926
- 2
- 10
- 26
9
votes
5 answers
Presenting a modal view controller without covering the current view on iPhone
I have been trying to add view container with leaving 20px space from the sides. But it seems not the proper way of doing it...
// ADD CHILD VIEW CONTROLLER
[parentViewController addChildViewController:childViewController];
…

Mazen Kasser
- 3,559
- 2
- 25
- 35
9
votes
3 answers
Container View Controllers - notify parent of action
Say I have a custom container view controller (MainViewController) where I do something like this:
- (void)viewDidLoad
{
[super viewDidLoad];
HomeViewController *homeVC = [[HomeViewController alloc]…

soleil
- 12,133
- 33
- 112
- 183
8
votes
3 answers
How to create a container/child viewcontroller relationship in interface builder
To create from code a parent/child relationship between 2 view controllers basically it's just matter of doing something like:
[self addChildViewController:childViewController];
[self.view addSubview:childViewController.view];
where self is the…

ggould75
- 880
- 2
- 14
- 23
7
votes
1 answer
Child view controller should have parent view controller but actual parent is (UIViewControllerHierarchyInconsistency)
I have an app which has UITabbarController as the initial window(after logging-in i set it as rootViewController)
This tabbarController has 4 different tabs in it which are all UIViewControllers embedded in a UINavigationController.
In my…

Radun C
- 69
- 1
- 3
7
votes
1 answer
UISearchController hides results above the search bar
I am using a UISearchController inside a Container view in a UITableView. I am adding the search bar like this:
self.resultsTableController = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([ResultViewController…

Umair Suraj
- 480
- 11
- 22