Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITabBar selectionIndicatorImage height on iPhone X

I'm using a selectionIndicatorImage for a UITabBar, which is 49 points high, like this: UITabBar.appearance().selectionIndicatorImage = UIImage(named: "bg-tab-selected")

Works just fine across all devices: enter image description here

Except for the iPhone X:

enter image description here

I've tried setting the images to be vertically sliced only in the asset catalog, but that doesn't seem to have the desired effect. For some reason it also stretches horizontally? And there is a bit of padding on top.

enter image description here

Any ideas how I can fix this?

like image 704
Ben Williams Avatar asked Sep 18 '17 10:09

Ben Williams


1 Answers

I had the same issue. I "fixed" it by subtracting the height by 1 pixel, so 48 pixels for the height of the selection image. It seems to be an iPhone X bug.

like image 79
Huy Hoang Avatar answered Sep 18 '22 14:09

Huy Hoang