Search code examples
iosobjective-cuinavigationcontrolleruipopovercontroller

popover content view doesn't display while viewcontroller has a child VC present


I have a container view controller that consists of a navigation view at top, and a content view for the remainder of the screen. The navigation menu consists of several buttons, some of which present a popover with UITableView for secondary navigation. This all worked until I assigned a child view controller and set it's view as subview of the content view. Now, the popover appears, but has nothing inside it (no tableview, just black).

Why is this? Here's the code I added for the child vc in container view:

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
  ContentWebViewController *initialVC = [[ContentWebViewController alloc] init];
  [self addChildViewController:initialVC];
  initialVC.view.frame = self.view.bounds;
  [self.containerView addSubview:initialVC.view];
  self.currentController = initial;
}

See the screenshot below. I added a vc with a simple webview showing google (just as a placeholder for now). The popover was working fine before I assigned the child VC.

enter image description here


Solution

  • I somehow (don't ask me how) changed the class that my table view controller was inheriting from. It should have been (obviously) UITableViewController, but was UITableViewController, so initWithStyle was not being called....