问题
I've got a storyboard with a view wrapped in a navigationcontroller, that has a UI tab bar at the bottom. I dynamically add sub views to this view, but there is always a blank line between the navigation bar and the subview that appears to be the width of a status bar. On each of the subviews that are created on the storyboard I have their Simulated Metrics set to have a bottom bar as a Tab Bar, status bar is set to none, and top bar is set to navigation bar.
Below is my code for adding the sub view:
if(!self.homeViewController){
self.homeViewController = [self.storyboardinstantiateViewControllerWithIdentifier:@"HomeView"];
}
if(self.currentViewController != self.homeViewController)
{
[self.view insertSubview:self.homeViewController.view belowSubview:self.tabBar];
[self.currentViewController removeFromParentViewController];
}
self.currentViewController = self.homeViewController;
回答1:
On your homeViewController defined in Storyboard, set the 'Resize View From NIB' property to unticked (this is ticked by default). This cured the gap problem for me.
来源:https://stackoverflow.com/questions/12310683/adding-subview-leaves-gap-between-subview-and-navigation-bar