IOS 13中的UITabbar UI问题| XCode 11

问题描述 投票:0回答:1

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

UITabbar UI Issue

    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中正常工作。请提出任何解决此问题的解决方案。

预先感谢

ios objective-c uitabbarcontroller ios13 tabbar
1个回答
0
投票

您必须替换此行...

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

...和...

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

addSubview文档:

要添加的视图。添加后,此视图将出现在任何其他子视图的顶部

© www.soinside.com 2019 - 2024. All rights reserved.