我正在使用 UITabBarController
。在我的 AppDelgate
中,我将 selectionIndicatorImage
设置为一条简单的白线。这显示在选项卡栏项目的中间。我希望它显示在我的标签栏项目的顶部,突出显示它已被选中。我尝试制作一个顶部有白线、底部透明的图像,但它只是显示在我的标签栏上方。是否需要一定的尺寸才能制作此图像以实现我所追求的目标?
我使用的图像: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]];
关于ios - UITab 栏 - 选择指示器图像 - 更改位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50631644/