UITabBarItem 只显示没有图像的文本?
Display only text without image for UITabBarItem?
我只想显示没有图像的标签栏项目的标题。是否可以?当我尝试设置
let tabItem = UITabBarItem()
tabItem.title = "Tab1"
tabItem.selectedImage = nil
tabItem.image = nil
tabViewController?.tabBarItem = tabItem
我只是得到一个空白 space 可以点击,但没有标题或图像。
最简单的方法是从标签栏中删除图像并设置图像中显示的自定义偏移量 vertical.as。或者遵循 TJ3n priveded remove the images in the UITabBarItem and aligned vertically the title.
的 link
如果您希望以编程方式完成:
tabItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -16)
我只想显示没有图像的标签栏项目的标题。是否可以?当我尝试设置
let tabItem = UITabBarItem()
tabItem.title = "Tab1"
tabItem.selectedImage = nil
tabItem.image = nil
tabViewController?.tabBarItem = tabItem
我只是得到一个空白 space 可以点击,但没有标题或图像。
最简单的方法是从标签栏中删除图像并设置图像中显示的自定义偏移量 vertical.as。或者遵循 TJ3n priveded remove the images in the UITabBarItem and aligned vertically the title.
的 link如果您希望以编程方式完成:
tabItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -16)