UITabBarItem文字位置适配IOS13解决办法

在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;

    }

posted @ 2020-07-29 22:10  objectZhu  阅读(1311)  评论(0编辑  收藏  举报