gpt4 book ai didi

ios - 集中中央标签栏按钮

转载 作者:行者123 更新时间:2023-12-01 19:17:56 29 4
gpt4 key购买 nike

怎么做?中央标签栏按钮的圆顶效果?这是圆顶图像在规则中央形状的选项卡按钮顶部的简单投影吗?还是还有什么?

最佳答案

您可以通过

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

请检查以下链接:
http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button/

您将在 https://github.com/boctor/idev-recipes/tree/master/RaisedCenterTabBar上获得完整的源代码。

关于ios - 集中中央标签栏按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11959525/

29 4 0