我有一个奇怪的问题。每当我的应用程序启动时,我都会在AppDelegate中执行以下操作:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setTintColor:[UIColor mainLightBlue]];
    [[UITabBar appearance] setTintColor:[UIColor mainLightBlue]];

    [IJContext setDefaultContext:[[IJContext alloc] init]];
    RKLogConfigureFromEnvironment();
    return YES;
}

然后,如果我的用户成功登录,则在AppDelegate中执行以下操作:
-(void)presentNewsFeed
{
    RKLogConfigureByName("RestKit/Network", RKLogLevelDebug);
    UIViewController *newTopViewController = [[UIStoryboard storyboardWithName:@"MainiPadStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"GlobalInitialSliding"];
    [_window setRootViewController:newTopViewController];
}

至此,setTintColor运行正常。现在,每当用户注销时,我都会致电:
- (void)presentLoginScreen
{
    UIViewController *newTopViewController = [[UIStoryboard storyboardWithName:@"MainiPadStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"Login"];
    [_window setRootViewController:newTopViewController];
}

再次位于AppDelegate中。如果重新登录,我会再次调用presentNewsFeed。但是,第二次,setTintColor不再起作用,并且所有我的选项卡在选择时实际上都没有tintColor。因此,我的用户实际上无法知道选择了哪个选项卡。有什么想法吗?

最佳答案

我在tintColor中还有另一个viewController声明,它与appDelegate中的声明搞混了!

谢谢

10-08 01:15