1

在该(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法中,我初始化了一个 UINavigationControllerGeneralOptionsTableViewController的实例和一个GeneralOptionsMapViewController. 导航栏颜色设置为绿色。GeneralOptionsTableViewController但是,当我使用and在 UINavigationController 之间切换时GeneralOptionsMapViewController,navigationBar 变得透明。我尝试在方法中重置导航栏颜色,viewWillAppear但它似乎不起作用。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    GeneralObjectTableViewController *generalObjectTableViewController = [[GeneralObjectTableViewController alloc] init];
    GeneralObjectMapViewController *generalObjectMapViewController = [[GeneralObjectMapViewController alloc]init];
    UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:generalObjectTableViewController];
    navigationController.navigationBar.barTintColor = [UIColor greenColor];


    UITabBarController *tabBarController = [[UITabBarController alloc]init];
    [tabBarController setViewControllers:[NSArray arrayWithObjects:navigationController, generalObjectMapViewController, nil]];

    [self.window setRootViewController:tabBarController];

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}
4

0 回答 0