Lucas
Lucas

Reputation: 11

UITabBar items title issue, when the title is long and using UITabBarAppearance

Because of iOS 15’s scrollEdgeAppearance transparent problem, I have to use UITabBarAppearance to set my UITabBar. But when using UITabBarAppearance, if the title is long, it will overflow the item area.

↓This is before I add scrollEdgeAppearance. I only implemented UITabBarController and UIViewController to display, without any appearance setting.

iPhone SE (1st generation)(15.2)(Xcode 13.2.1) (I can't embed images in my post yet so it is a link)

When I added these code:

if #available(iOS 13.0, *){
   let tabBarAppearance = UITabBarAppearance()
   UITabBar.appearance().standardAppearance = tabBarAppearance

   if #available(iOS 15.0, *){
      UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
   }
}

↓It will be like this:

iPhone SE (1st generation)(15.2)(Xcode 13.2.1)(I can't embed images in my post yet so it is a link)

As you can see that “VeryLongTitle” overlaps into each other, and short “title”s are fine.

I think it is an API bug, but I couldn't find any workaround to fix it.

(I already tried this issue’s answer, and it didn’t work: iOS TabBar item title issue in iOS13 so I think it is a different bug.)

Does anyone know how to fix it?

Upvotes: 1

Views: 454

Answers (0)

Related Questions