I have a UIViewController
(red) set as the first tab of a UITabBarController
as shown in the storyboard below. This view controller is a container view controller and loads a UINavigationController
inside its contentView
(the white rectangle inside the red view controller).
This is my code for loading the navigation controller inside the red view controller's contentView
:
- (void)viewDidLoad
{
[super viewDidLoad];
// instantiate navigation controller
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *navigationVC = [storyboard instantiateViewControllerWithIdentifier:@"N"];
// place navigation controller inside content view
[self addChildViewController:navigationVC];
navigationVC.view.frame = self.containerView.bounds;
[self.containerView addSubview:navigationVC.view];
[navigationVC didMoveToParentViewController:self];
}
From what I know about view controller containment this should work as I am explicitly setting the frame for the navigation controller. However, when there are enough cells in the tableView
to exceed the container's height there is always a bar at the end of the tableView
when I scroll down. I have set the tableView
's backgroundColor
to orange and the cell's backgroundColor
to white in order to see the difference.
How do I get rid of that orange gap at the end of the tableView
?
(Note: I am not using autolayout and I need a solution that works for both - iOS7 and iOS6.)
I know you are also looking for an answer which works on iOS 6, but on iOS 7 and above you can use
Have you tried setting
self.edgesForExtendedLayout = UIRectEdgeAll;
in-(void)viewDidLoad
ofTable View Controller - Root
?Note: iOS 7 only