gpt4 book ai didi

ios - UITab 栏 - 选择指示器图像 - 更改位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:02:47 25 4
gpt4 key购买 nike

我正在使用 UITabBarController。在我的 AppDelgate 中,我将 selectionIndicatorImage 设置为一条简单的白线。这显示在选项卡栏项目的中间。我希望它显示在我的标签栏项目的顶部,突出显示它已被选中。我尝试制作一个顶部有白线、底部透明的图像,但它只是显示在我的标签栏上方。是否需要一定的尺寸才能制作此图像以实现我所追求的目标?

enter image description here

我使用的图像:https://www.dropbox.com/s/zva77z9yt6rcfsg/SelectedTab.png?dl=0

 UIImage *selectedImage = [[UIImage imageNamed:@"SelectedTab"] stretchableImageWithLeftCapWidth:0 topCapHeight:0];

[[UITabBar appearance] setSelectionIndicatorImage:selectedImage]

最佳答案

您必须创建带有顶部白线的半透明 selectedTab(请参阅 zip 文件)并且 height 应为 48 像素

检查此链接 https://www.dropbox.com/s/j38mqj8sd0qgv8f/selectedTab.zip?dl=0

  [[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selectedTab.png"]];
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];

结果: enter image description here

关于ios - UITab 栏 - 选择指示器图像 - 更改位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50631644/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com