作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在以编程方式实例化一个将管理 2 个 View Controller 的 UITabBarController
,然后将其设置为 rootViewController
。但是,当 View 出现时,它会突出显示所有选项卡项的图像(尽管文本已正确突出显示)。无论我对 selectedIndex
设置什么,图像都将突出显示。只有当您点击标签栏项目时,它才会真正切换图像上的突出显示状态。这是怎么回事?
代码:
UITabBarController *tabController = [[UITabBarController alloc] init];
UIStoryboard *storyboard = [self storyboard];
OGVideoStreamViewController *questionsController = [storyboard instantiateViewControllerWithIdentifier:@"OGVideoStreamViewController"];
questionsController.isQuestion = YES;
OGVideoStreamViewController *answersController = [storyboard instantiateViewControllerWithIdentifier:@"OGVideoStreamViewController"];
answersController.isQuestion = NO;
OGMatchesViewController *matchesController = [[OGMatchesViewController alloc] initWithNibName:@"OGMatchesViewController" bundle:nil];
questionsController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Questions" image:[UIImage imageNamed:@"Tab Icon - Questions"] tag:0];
answersController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Answers" image:[UIImage imageNamed:@"Tab Icon - Answers"] tag:1];
matchesController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Inbox" image:[UIImage imageNamed:@"Tab Icon - Inbox"] tag:2];
[tabController setViewControllers:@[questionsController, answersController, matchesController] animated:NO];
tabController.selectedViewController = questionsController;
[[UIApplication sharedApplication] keyWindow].rootViewController = tabController;
最佳答案
我遇到了同样的问题,这是因为我调用:
[UIView appearance].tintColor = [UIColor colorWithRed:1.000
green:0.793
blue:0.236
alpha:1.000];
我在 AppDelegate 中调用了它,所以我可以将其更改为以下内容:
self.window.tintColor = [UIColor colorWithRed:1.000
green:0.793
blue:0.236
alpha:1.000];
关于ios - UITabBarController 最初突出显示所有选项卡栏项目图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23861616/
有没有一种方法可以“标记”对象的属性,使它们在反射中“突出”? 例如: class A { int aa, b; string s1, s2; public int AA
我是一名优秀的程序员,十分优秀!