Changing tab bar font in Swift

后端 未结 7 1104
南方客
南方客 2020-12-16 10:03

I have been trying to change the font for the tab bar items however I haven\'t been able to find any Swift examples. I know that this is how you change it in Objective-C:

相关标签:
7条回答
  • 2020-12-16 11:02

    In addition @Mc.Lover 's answer, If you want to aplly this change to all of your tab bar Items in application, I recommand to add the code in application function of AppDelegate class:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
        //Just add this line to get it done.       
        UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "IranSansMobile", size: 15)!], for: UIControlState.normal)
    
        return true
    }
    
    0 讨论(0)
提交回复
热议问题