I have a UIViewController with a UIToolbar (below) and I want to add a UINavigationController with a UINavigationBar inside. But the UINavigationController is not displayed.
MyViewController.m:
- (void)viewDidLoad { [super viewDidLoad]; int toolBarHeight = 44; UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, [self.view bounds].size.height-toolBarHeight, [self.view bounds].size.width, toolBarHeight)]; UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:nil action:nil]; toolBar.items = @[button]; [self.view addSubview:toolBar]; MyNavigationController *myNav = [[MyNavigationController alloc] init]; [self addChildViewController:myNav]; }
source share