首页 > 解决方案 > 为什么 UITabBar 在 iOS 13 中工作异常?

问题描述

我有使用 swift 4.2 处理 UITabBarItem 的代码。只有当该页面已被购买时才能打开。这是我的代码

func setupTabBar(){
    tabBarItems = tabBar.items
    if(typePage == "ばんそう"){
        self.selectedIndex = 0
        if(pageInfo?.pdfFiles == ""){
            tabBarItems![1].image = UIImage(named: "ic_cross_gray")
            tabBarItems![1].title = "ドリル"
        } else {
            if !IAPHandler.instance.lockHandler(isDrill: true, bookType: IAPHandler.instance.typeFilter(type: titleNav)!) {
                tabBarItems![1].image = UIImage(named: "ic_lock")
                tabBarItems![1].title = "ドリル"
            }
        }
    } else if(typePage == "ドリル") {
        self.selectedIndex = 1
        if(pageInfo?.song.count == 0){
            tabBarItems![0].image = UIImage(named: "ic_cross_gray")
            tabBarItems![0].title = "ばんそう"
        } else {
            if !IAPHandler.instance.lockHandler(isDrill: false, bookType: IAPHandler.instance.typeFilter(type: titleNav)!) {
                tabBarItems![0].image = UIImage(named: "ic_lock")
                tabBarItems![0].title = "ばんそう"
            }
        }
    }
}

该功能运行良好。但是 UI iOS 13 有一个错误。这是 iPhone 6 和 iOS 12 的屏幕截图。

在此处输入图像描述

但是当我在带有 iOS 13 的 iPhone X 上运行时,这很奇怪。相同的代码,相同的一切,只是在不同的设备上运行。

在此处输入图像描述

标签: swiftxcodeuitabbar

解决方案


推荐阅读