小编ImW*_*mWH的帖子

UITabBarAppearance 在 iOS15 iPad 上不起作用(标题颜色)

我创建了一个简单的演示,仅创建了 UITabBarController 的子类并在故事板中设置。

我想在选择时将 TabBarButtonItem 的标题设置为橙色,在正常情况下将标题设置为黑色。以下代码在 iPhone 上的任何 iOS 版本上都可以正常工作,但在 iOS 15 的 iPad(设备和模拟器)上,所选颜色更改为蓝色和有线正常状态颜色。

这是苹果的错误还是我错过了什么?(我使用的是 Xcode13)

class CustomViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let tabBarAppearnace = UITabBarAppearance()
        let tabFont =  UIFont.boldSystemFont(ofSize: 18)
        
        let selectedAttributes: [NSAttributedString.Key: Any]
        = [NSAttributedString.Key.font: tabFont, NSAttributedString.Key.foregroundColor: UIColor.orange]
        let normalAttributes: [NSAttributedString.Key: Any]
        = [NSAttributedString.Key.font: tabFont, NSAttributedString.Key.foregroundColor: UIColor.black]
        
        tabBarAppearnace.stackedLayoutAppearance.normal.titleTextAttributes = normalAttributes
        tabBarAppearnace.stackedLayoutAppearance.selected.titleTextAttributes = selectedAttributes
        
        tabBar.standardAppearance = tabBarAppearnace
    }
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

uitabbaritem ios swift ios15

5
推荐指数
1
解决办法
2441
查看次数

当我更新到 Xcode15 时,我收到很多警告:“混合 ObjC ABI,xxx 编译时没有类别类属性”

当我使用 Xcode 14 时,我没有遇到任何警告。然而,更新到 Xcode 15 后,我突然开始收到来自第三方库的 200 多个警告。有谁知道这样做的原因或如何解决这些警告而不必等待库更新?这些警告似乎与库中 Objective-C 的使用有关。

类似这样的警告: Mixed ObjC ABI, /Users/wanghong/Developer/alpaca/Pods/AppsFlyerFramework/iOS/AppsFlyerLib.framework/Versions/A/AppsFlyerLib[x86_64][26](AppsFlyerAES128Crypto.o) compiled with category class properties

在此输入图像描述

xcode ios xcode15

5
推荐指数
1
解决办法
1911
查看次数

标签 统计

ios ×2

ios15 ×1

swift ×1

uitabbaritem ×1

xcode ×1

xcode15 ×1