Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add font name for custom font #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion RAMAnimatedTabBarController/RAMAnimatedTabBarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down