在ios13之前设置tabbar下部文字位置:
[[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(0, -5)];
但是在ios13后需要作出判断:
if (@available(iOS 13.0, *)) {
UITabBarAppearance *appearance = [UITabBarAppearance new];
appearance.stackedLayoutAppearance.normal.titlePositionAdjustment = UIOffsetMake(0, -5);
appearance.stackedLayoutAppearance.selected.titlePositionAdjustment = UIOffsetMake(0, -5);
self.tabBarItem.standardAppearance = appearance;
}
原文:https://www.cnblogs.com/objectZhu/p/13399963.html