且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将 UITabBarItem Image 向下移动?

更新时间:2023-12-02 22:35:10

尝试调整 tabBarItemimageInsets(用于移动图标图像)并将控制器标题设置为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

UITabBarItemUIBarItem 的子类,它具有 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)