I am having difficulty passing data to a tableViewController that is housed within a container view as can be seen here:
For context, the View controller which contains the two container views is itself the first tab of a tabViewController that act as the Master View for the Detail View of a splitViewController.
First of all - am I using the container views appropriately? The purpose of this first tab is to display some filter 'settings' at the top which are editable via a push segue (hence its being a navigation controller), and at the bottom, the tableView's data will update based on the filter criteria. It seemed intuitive to use two container views to accomplish this functionality, but I have very little experience and don't know if there is a better way or if container view's utility is more niche-y than it would seem.
To the original question - presuming this hierarchy makes sense, I am having difficulty passing data to this particular tableViewController. There are two other tabs in the tabViewController, neither of which utilize a container view and so I have been able to successfully traverse the hierarchy to display data in these tabs using the appDelegate as follows:
// Initial Setup
UISplitViewController *splitViewController = (UISplitViewController *) self.window.rootViewController;
UITabBarController *masterTabBarController = [[splitViewController viewControllers] objectAtIndex:0];
// Tab 1: Filter by Location:
// >>> **PROBLEM CODE SEGMENT** <<<
UIViewController *containerViewController = [[masterTabBarController viewControllers] objectAtIndex:0];
MasterViewController *masterViewController0 = [[containerViewController childViewControllers] objectAtIndex:1];
masterViewController0.slotMachines = machines;
// Tab 2: Filter by ID#:
MasterViewController *masterViewController1 = [[masterTabBarController viewControllers] objectAtIndex:1];
masterViewController1.slotMachines = machines;
// Tab 3: Audited
MasterViewController *masterViewController2 = [[masterTabBarController viewControllers] objectAtIndex:2];
masterViewController2.slotMachines = machines;
I have skipped the snippet of code that assigns data via delegate to each of masterViewController0/1/2. As mentioned, Tabs 2 and 3 work. Tab 1 breaks the program at runtime, terminating due to '[containerViewController childViewControllers]' returning an empty array, and so the call for objectAtIndex:1 (which I had hoped would refer to the tableView) is out of bounds. I wonder if the containerview is not initialized at this point in program execution? But I honestly have no idea.
I think my query has less to do with container views specifically and more to do with hierarchy traversal, and so despite looking into solutions in documentation on container views, I really have not found much help.
Thanks you in advance for any tips!