UITab 栏 - 选择指示器图像 - 更改位置
UITab Bar - Selection Indicator Image - Change Position
我正在使用 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]
您必须创建带有顶部白线的 translucent
selectedTab(参见 zip 文件)并且 height
应该是 48 Pixel
检查这个 link https://www.dropbox.com/s/j38mqj8sd0qgv8f/selectedTab.zip?dl=0
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selectedTab.png"]];
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
结果:
我正在使用 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]
您必须创建带有顶部白线的 translucent
selectedTab(参见 zip 文件)并且 height
应该是 48 Pixel
检查这个 link https://www.dropbox.com/s/j38mqj8sd0qgv8f/selectedTab.zip?dl=0
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selectedTab.png"]];
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
结果: