簡體   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