我正在使用3个选项卡栏项目的UITabBar。我想自定义居中选项卡项目。就像凸起的标签栏按钮。
我知道如何添加和定制UITabBarController。但是我想要定制UITabBar。
我想在选项卡栏中添加一个自定义按钮作为中心选项卡栏项目,如下所示:

发布于 2012-08-21 21:12:56
检查此http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/
UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);
[button setBackgroundImage:buttonImage forState:UIControlStateNormal];
[button setBackgroundImage:highlightImage forState:UIControlStateHighlighted];
CGFloat heightDifference = buttonImage.size.height - self.tabBar.frame.size.height;
if (heightDifference < 0)
button.center = self.tabBar.center;
else
{
CGPoint center = self.tabBar.center;
center.y = center.y - heightDifference/2.0;
button.center = center;
}
[self.view addSubview:button];发布于 2012-08-21 20:29:39
你可以改变
backgroundImage property
selectedImageTintColor property
selectionIndicatorImage property
tintColor property实用工具栏的
也许你可以用一张背景图片来完成。如果不是,那么你必须编写你自己的标签栏。
https://stackoverflow.com/questions/12054707
复制相似问题