更新时间:2023-12-02 22:35:10
尝试调整 tabBarItem
的 imageInsets
(用于移动图标图像)并将控制器标题设置为nil(所以不显示标题).把这样的东西放在视图控制器中的 -init
或 -viewDidLoad
方法中:
Try adjusting tabBarItem
's imageInsets
(for moving the icon image) and setting the controllers title to nil (so no title is displayed). Put something like this to -init
or -viewDidLoad
method in view controller:
目标 C
self.tabBarItem.imageInsets = UIEdgeInsetsMake(6, 0, -6, 0);
self.title = nil;
迅捷
self.tabBarItem.imageInsets = UIEdgeInsets(top: 6, left: 0, bottom: -6, right: 0)
self.title = nil
UITabBarItem
是 UIBarItem
的子类,它具有 UIEdgeInsets imageInsets
属性.稍微使用插图直到它看起来不错(取决于您的标签栏图标图像)
UITabBarItem
is a subclass of UIBarItem
which has UIEdgeInsets imageInsets
property. Play a little with the insets until it looks good (depending on your tabbar icon images)