Questions tagged [childviewcontroller]

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)

242 questions
0
votes
2 answers

UIButton doesn't work in child view controller

UIButton gestures doesn't recognize in child view controller. UIButton add targer work (button get target action) User interaction is turned on everywhere, button size is okay. I try to set childVC as main, and then all work good, debug view…
0
votes
2 answers

Remove child view controller

I have the following code: func setUpPageController(viewControllers: [UIViewController]) { let pagingViewController = PagingViewController(viewControllers: viewControllers) pagingViewController.menuInsets = UIEdgeInsets(top: 1, left:…
0
votes
1 answer

Why doesn't my UILabel in a nested view receive touch events / How can I test the Responder Chain?

I have found lots of similar questions about not receiving touch events and I understand that in some cases, writing a custom hitTest function may be required - but I also read that the responder chain will traverse views and viewControllers that…
0
votes
1 answer

Determining the height of a child VC's content from the container VC, and using it to size the container vc?

I have a container view controller that can hold any generic ViewController. If I use a stack view, or any other view (without a scroll view), I can accurately calculate the size in my container initializer using the following: let targetSize =…
KingPolygon
  • 4,753
  • 7
  • 43
  • 72
0
votes
1 answer

how to load child view controllers or container views - Swift

I don't have a problem displaying each container view when switching between them using the segmented controller. What I do have a problem with is that whenever the parent view loads, both the blue and green container views also load. I want the…
Chris Comas
  • 216
  • 4
  • 10
0
votes
1 answer

Customizing width and height for child view controller does not work

I'm trying to set the width and height of my child view controller's frame, but it's not working. Here's what I'm trying to do: let frame = UIScreen.main.bounds let vc = FieldsTableViewController() addChild(vc) view.addSubview(vc.view) …
Farid M
  • 1
  • 2
0
votes
2 answers

Adding a CollectionViewController as a subView

Using Swift 5.1.3, iOS13.3, XCode11.3, I try to display a horizontal collectionView that is wider than the view's width. By dragging, the collectionView cells shall scroll horizontally. The problem now is the following: As soon as I click to drag,…
iKK
  • 6,394
  • 10
  • 58
  • 131
0
votes
0 answers

Eventual crash when nesting child UIViewControllers

I am creating two child view controllers childA and childB to be displayed and managed by a view controller parent. I'm hoping to master how nested child controllers work, but right now end up with a crash. I created a generic extension to…
Dylan
  • 2,315
  • 2
  • 20
  • 33
0
votes
1 answer

Delegate change from child view to main view

I have UIViewController with mainView and ChildView. I want change label in mainView from ChildView Child I add by let to = ChildView() self.addChild(to) self.mainView.addSubview(to.view) self.mainViewConstraint.constant =…
Oleg
  • 61
  • 5
0
votes
1 answer

PanGestureRecognizer on child view controller

I have a PanGestureRecognizer set on a child view controller's container view. This is essentially a drawer view, so I want the child view controller to handle any scrolls, except for when the child view controller's table view is scrolled to the…
0
votes
1 answer

Push View Controller From Child View Controller

I have an app where there is a "DadViewController" which contains a UIScrollView that has paging enabled. Each page is populated with a different UIViewController. How Do I push a new UIViewController, from a button tap, within one of the…
0
votes
1 answer

How to adjust height of child view controller to match container view's height

I have a container View with adjustable height. Now I want to set the same frame of the view of child view controller according to container view's height. Sometimes it does work in the simulation but often it fails. The frame of child view…
TBH
  • 145
  • 1
  • 11
0
votes
3 answers

Does childViewControllers array have a specific order in a view controller with various containers?

I have a base View Controller with various containers inside it. I use them to control the current step on a process, and only one of them is visible at a time. I created a enum for the steps, and use it's Int rawValue to access the containers…
GustavoAzOl
  • 299
  • 2
  • 12
0
votes
1 answer

Xcode: Child view controller doesn't load properly once given custom class name

I have a view controller which has a container within it which connects to a child view controller. Everything was working great as I constructed my layout within xcode for the child view controller. However, once I gave the child view controller a…
Birdman
  • 1,404
  • 5
  • 22
  • 49
0
votes
0 answers

Taking View Screenshot Crash - UIViewControllerHierarchyInconsistency Only in ViewWillAppear

I am facing strange issue which is when I used following code to take screen shot in viewWillAppear app crashes let renderr = UIGraphicsImageRenderer(size: self.view.bounds.size) let image = renderr.image { (ctxt) in view.drawHierarchy(in:…
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98