gpt4 book ai didi

ios - UITabBar setTintColor 在 [_window setRootViewController] 之后不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:44:07 25 4
gpt4 key购买 nike

我有一个奇怪的问题。每当我的应用程序启动时,我都会在 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。所以我的用户实际上不知道选择了哪个选项卡。关于原因有什么想法吗?

最佳答案

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

谢谢

关于ios - UITabBar setTintColor 在 [_window setRootViewController] 之后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21460357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com