繁体   English   中英

IOS 13 中的 UITabbar UI 问题 | XCode 11

[英]UITabbar UI issue in IOS 13 | XCode 11

当我在 XCode 11.1 中运行应用程序时,UITabbar 未选中的项目不可见,如图所示

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.tabBar addSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottombar.png"]]];

... 和...

[tController.view insertSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottombar.png"]]
                   belowSubview:tController.tabBar];

addSubview文档:

要添加的视图。 添加后,此视图显示在任何其他子视图之上

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM