-1

I am able to manipulate the content of ViewControllerA that has ViewA. I do not want to edit the content of ViewControllerB for a couple of reasons.

Under my view hierarchy, ViewA contains ViewControllerB which has ViewB. How do I get viewB. If I get it, I'd like to resize it which I can do but I can't seem to get it.

This current code gives me viewA.

ViewA = ViewControllerA.view

How do I get ViewB?

Rhaystack
  • 7
  • 2
  • Your desription says `ViewControllerA` has attribute `ViewA`, which has property `ViewControllerB`, which has attribute `ViewB`. If so, finding `ViewB` is simple. Probably your description is wrong. Please verify and update. – Jerry Jun 26 '20 at 00:57
  • how ViewControllerB's view got into ViewA hierarchy? do you have access to ViewControllerB.view? – in.disee Jun 26 '20 at 01:03
  • So viewcontroller B is a child of view controller A. – Rhaystack Jun 26 '20 at 03:22
  • Please share the code how you set up `ViewControllerB` and `ViewB`. – koen Jun 26 '20 at 12:23
  • Okay, `ViewControllerB` is a subclass of `ViewControllerA`, so what are you trying to do? You should show your code or explain in more detail. – Jerry Jun 26 '20 at 13:14

1 Answers1

0

Hey sorry for the confusion here but what I was doing was actually a little more complicated than this. I was adding a view controller that had several layers of view controllers and views as a childViewController to my view controller. This created quite a complex hierarchy such that just simply getting the view from the childviewcontroller,viewcontrollerB, inside my viewcontrollerA and resizing the part that I wanted inside this view controlleraA wasn't working. My only option was to edit the content of viewControllerB itself, which I didn't want to do at first, to assume the size of the parent view controller A's view.

Made a new method inside viewcontrollerB with this code

childViewController.view.frame = _owner.view.bounds;
[childViewController.view setNeedsLayout];
Rhaystack
  • 7
  • 2