目标 c:标签栏不显示

问题描述

我已经按照 Programmatically creating tab bar for ViewControllerHow can I create a tab view programmatically on iOS 尝试使用目标 c 在我的 ViewController 中以编程方式创建标签栏,但我的标签栏没有显示。这是我在 AppDelegate.m 中的代码

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FIRApp configure];
    self.ref = [[FIRDatabase database] reference];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window makeKeyAndVisible];
    
    
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    ViewController *viewController = [[ViewController alloc]init];
    viewController.title =@"Home";
    UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:viewController];
    NSArray *viewControllers = [NSArray arrayWithObjects:viewController,nil];
    [viewController release];
    [tabBarController setViewControllers:viewControllers animated:NO];

    // Put the tabBarController's view on the window.
    [self.window addSubview:[tabBarController view]];
    self.window.rootViewController = tabBarController;

    
    return YES;
}

没有错误,只是没有显示标签

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)