Can i only display text in tab bar item and change the style and position
Asked Answered
L

1

0

I add a tab bar in storyboard, and do not want to set an image to the tab bar item, and like the following:

enter image description here

How can I change the font and the position for the title of the bar item in storybord?

Louls answered 14/4, 2017 at 10:56 Comment(0)
G
5

First select the tab bar item in storyboard, than in Attributes Inspector set System Item and Title Position to Custom, so you will be able to change the position of the title by setting values to Horizontal and Vertical boxes.

enter image description here

Finally, to change the font, in your viewDidLoad(), include:

UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Avenir-BlackOblique", size:20)!, NSForegroundColorAttributeName: UIColor.blue], for: .normal)

NSFontAttributeName allow you to change the font style and NSForegroundColorAttributeName allow you to change the font color.

Goins answered 14/4, 2017 at 13:7 Comment(1)
what about the image it self, i try to adjust it by using the image insetPublication

© 2022 - 2024 — McMap. All rights reserved.