【发布时间】:2020-09-23 15:24:52
【问题描述】:
当我在 XCode 11.1 中运行应用程序时,UITabbar 未选中的项目不可见,如图所示
UITabBarController *tController=[[UITabBarController alloc] init];
tController.tabBar.selectionIndicatorImage = [UIImage imageNamed:@"footerhover.png"];
[tController.tabBar addSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottombar.png"]]];
NSMutableArray *arr=[[NSMutableArray alloc] init];
ProfileViewController *pViewController=[[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
pViewController.tabBarItem.title=@"PROFILE";
pViewController.tabBarItem.image=[UIImage imageNamed:@"profile_white.png"];
pViewController.tabBarItem.tag = 1;
if ([[[UIDevice currentDevice] systemVersion] compare:@"5.0" options:NSNumericSearch] == NSOrderedAscending) {
}else{
[pViewController.tabBarItem setImage:[[UIImage imageNamed:@"profile.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[pViewController.tabBarItem setSelectedImage:[[UIImage imageNamed:@"profile_white.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
}
UINavigationController *nav1=[[UINavigationController alloc] initWithRootViewController:pViewController];
senderArray[0] = nav1;
[arr addObject:nav1];
tController.viewControllers=senderArray;
Tabbar 在 XCode 10.3 / IOS 12 中运行良好。 请提出解决此问题的任何解决方案。
提前致谢
【问题讨论】:
-
[tController.view insertSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottombar.png"]] belowSubview:tController.tabBar]?这是真正的代码吗?这很可疑,因为您将字符串数组分配给viewControllers属性等。 -
@zrzka 编辑了我的代码。请检查一下。
-
您是否尝试将底部栏图像视图移动到标签栏下方? (见第一条评论)
-
是的。部分有效,你能把它作为答案....! @zrzka
-
部分?所以有些东西仍然不适合你?
标签: ios objective-c uitabbarcontroller ios13 tabbar