0

I'm customising the UITabBar in my app. I have 3 tabs so when one is selected it has a background that spans 1/3 of the width of the screen. The only problem is, the screen is 320pt, so divide by 3 and we have a non-integer, thus leaving this horrible gap on the end. I set the background images of the selected state to 106pts and then tried it at 107pts, but that didn't help at all. Here is a picture of the TabBar demonstrating the nasty gap at the end.

enter image description here

It's quite hard to see, but it is there. Does anyone have advice as to how I can get rid of it. This is a subclassed UITabBar so obviously I can make modifications, but I would prefer to keep the fix as simple as possible.

Regards,
Mike

4

2 回答 2

2

认为我有一些修复,但它不是特别优雅。我将 UITabBar 的宽度增加到 321pts,因此在屏幕外绘制了一个额外的点,导致一个选项卡(不确定是哪一个)的大小扩大,从而填补了空白。

于 2013-04-26T10:05:19.637 回答
1

给中心元素的宽度deviceWidth / numberOfTabs + deviceWidth % numberOfTabs,和其他deviceWidth / numberOfTabs。这样,中心元素将是 108 像素,其他元素是 106 像素。

于 2013-04-26T09:21:14.837 回答