在该(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;
}