我通过包含使UINavigationController成为另一个视图控制器的子节点.一切正常,除了在打开呼叫状态栏打开时启动应用程序时出现的奇怪问题,然后在应用程序UI在屏幕上后将其切换回OFF.在状态栏的位置出现了一个奇怪的黑色间隙. 
  
 
考虑下面的自包含示例应用程序:
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong,nonatomic) UIWindow *window;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opt
{
  // Content
  UILabel * aLbl = [[UILabel alloc] initWithFrame:CGRectMake(20,100,200,40)];
  aLbl.text = @"In-call status bar issue";
  UIViewController * aContent = [[UIViewController alloc] init];
  aContent.title = @"Title";
  aContent.view.backgroundColor = UIColor.whiteColor;
  [aContent.view addSubview:aLbl];
  UINavigationController * aNav = [[UINavigationController alloc]
    initWithRootViewController:aContent];
  // Parentmost view controller containing the navigation view controller
  UIViewController * aParent = [[UIViewController alloc] init];
  [aParent.view addSubview:aNav.view];
  [aParent addChildViewController:aNav];
  [aNav didMovetoParentViewController:aParent];
  self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  self.window.rootViewController = aParent;
  [self.window makeKeyAndVisible];
  return YES;
}
@end
int main(int argc,char ** argv)
  { @autoreleasepool { return UIApplicationMain(argc,argv,nil,@"AppDelegate"); } } 
 重现问题的最简单方法是:
>启动iOS模拟器.
>按⌘Y打开通话中状态栏.状态栏将变为宽绿色.
>手动启动应用程序并等待导航控制器出现.
>再次按⌘Y可关闭通话中状态栏.
UI现在应该如下所示:
有谁知道如何解决这个问题?
解决方法
 您正在将视图(导航控制器的视图)作为子视图添加到另一个视图(父视图控制器的视图),而不给它一个框架!这是你永远不应该做的事情. 
  
 
        只需将这些行添加到您的代码中:
aNav.view.frame = aParent.view.bounds;
aNav.view.autoresizingMask = 
    UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 
 现在导航控制器的视图有一个框架,并相对于其超视图维护它.