Newest Update: I created a brand new project that is built the exact same way as below. However, this test project actually works just fine even though it seems to be the same... One thing I've noticed is that the parent view controller in the broken version is receiving the -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
when clicking on the child view controller's view... In the working version, the child view controller receives the event as it should... It's as if the parent view is blocking the child view or something..?
Progress Update: Upon screwing around a bit I have found that it works fine when directly assigning a frame to the child view controllers. However, I have to create my project using autolayout so that is what I've done. For some reason, autolayout is causing the child view controller's view to be unresponsive...
At the moment I have a viewcontroller which has just 1 childviewcontroller. The childviewcontroller's view shows up just fine but I cannot interact with the childViewController at all. The childViewController has a couple of UIButtons but they do not respond to clicks.
I tried testing with this in both the parent and child viewcontrollers.
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Touched!");
}
When clicking in the frame of the child view controller's view, this method responds in the parent view controller but not the child view controller.
The child view controller also works correctly when directly creating it and setting it as the root view controller in the app delegate.
The code I'm using in the parent view controller:
(void) viewDidLoad
{
[super viewDidLoad];
self.detailPageVC = [[GoalDetailsPageViewController alloc] init];
[self.view addSubview:self.detailPageVC.view];
[self addChildViewController:self.detailPageVC];
[self.detailPageVC didMoveToParentViewController:self];
}
Thanks for helping out a rookie! :)
detailPageVC
? – Infighting@property GoalDetailsPageViewController *detailPageVC;
^Is this what you are looking for? – Noisemaker