• 1
Votes
name
name Punditsdkoslkdosdkoskdo

[Swift - ios]How to get font default of UITabBarItem in ios

How to get font default of UITabBarItem. Please help if you can get it. Because I want to repeat with the default value. Font Size UITabBarItem changed that I do not know why.

UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: fontDault!], for: .normal)

 

The simplest solution would be to get the current title text attributes before you set your own attributes. Save that dictionary for use when you wish to reset to those original attributes.

let defaultAttributes = UITabBarItem.appearance().titleTextAttributes(for: .normal)

Then set your own attributes when needed.

When you wish to reset the attributes, do:

UITabBarItem.appearance().setTitleTextAttributes(defaultAttributes, for: .normal)

 

  • 1
Reply Report