From 05ba00f20af68df11e555466db6b5fc276909556 Mon Sep 17 00:00:00 2001 From: trungung Date: Sat, 22 Jan 2022 09:31:16 +0700 Subject: [PATCH] add font name for custom font --- .../RAMAnimatedTabBarController.swift | 6 +++++- RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RAMAnimatedTabBarController/RAMAnimatedTabBarController.swift b/RAMAnimatedTabBarController/RAMAnimatedTabBarController.swift index 07913535..83acd83a 100644 --- a/RAMAnimatedTabBarController/RAMAnimatedTabBarController.swift +++ b/RAMAnimatedTabBarController/RAMAnimatedTabBarController.swift @@ -206,7 +206,11 @@ open class RAMAnimatedTabBarController: UITabBarController { } textLabel.backgroundColor = UIColor.clear textLabel.textColor = item.textColor - textLabel.font = UIFont.systemFont(ofSize: item.textFontSize) + if item.fontName.isEmpty { + textLabel.font = UIFont.systemFont(ofSize: item.textFontSize) + } else { + textLabel.font = UIFont(name: item.fontName, size: item.textFontSize)! + } textLabel.textAlignment = NSTextAlignment.center container.addSubview(textLabel) diff --git a/RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift b/RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift index e41057d7..c365e3f9 100644 --- a/RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift +++ b/RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift @@ -39,7 +39,10 @@ open class RAMAnimatedTabBarItem: UITabBarItem { /// The font used to render the UITabBarItem text. @IBInspectable open var textFontSize: CGFloat = 10 - + + /// The font used to render the UITabBarItem text. + @IBInspectable open var fontName: String = "" + /// The color of the UITabBarItem text. @IBInspectable open var textColor: UIColor = #colorLiteral(red: 0.5079551811, green: 0.5472556715, blue: 0.6011400746, alpha: 1)