UITabBarViewController Navigation Item in displays in Status Bar area on Launch

独自空忆成欢 提交于 2019-12-24 19:05:40

问题


When launching a UITabBarViewController from code in a storyboard the first view displays the navigation controller too high in the status area. Tapping the tabs corrects it, however the first view is incorrect. Do I need something else in the AppDelegate? Specific code solutions would be appreciated. Thanks


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Need something here???

return YES;
}


// initial UITabBarViewController in Storyboard

- (void)viewDidLoad {
    [super viewDidLoad];

    UITabBarItem * startTab = [[UITabBarItem  alloc]initWithTitle:@"Home" image:[UIImage imageNamed:@"HomeTab.png"] tag:0]; 
     UITabBarItem * helpTab = [[UITabBarItem  alloc]initWithTitle:@"Help" image:[UIImage imageNamed:@"InfoDarkTab.png"] tag:1]; 

     UIStoryboard * phone = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
     StartListTVC *startVC = [phone instantiateViewControllerWithIdentifier:@"StartList"];
     HelpWebVC * helpVC  = [phone instantiateViewControllerWithIdentifier:@"HelpWeb"];


     UINavigationController *startNavVC = [[UINavigationController alloc] initWithRootViewController: startVC];
UINavigationController *helpNavVC = [[UINavigationController alloc] initWithRootViewController: helpVC];
     startNavVC.tabBarItem = startTab;
     helpNavVC.tabBarItem  = helpTab;
     NSArray *myViewControllers = [[NSArray alloc] initWithObjects:
         startNavVC,
         helpNavVC];

    [self setViewControllers:myViewControllers];
    }

来源:https://stackoverflow.com/questions/58286874/uitabbarviewcontroller-navigation-item-in-displays-in-status-bar-area-on-launch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!