我获得了标签的彩色标签图标,如下面的屏幕截图所示。
但是当我点击更多并查看更多标签时,我没有获得彩色标签图标
如何获取“更多”标签的彩色标签图标?这是我在AppDelegate的didFinishLaunchingWithOptions
UITabBar *tb = tabBarControllerProperty.tabBar;
NSArray *itemsObject = tb.items;
for(UITabBarItem *tabItem in itemsObject)
{
UIImage *imaged = tabItem.image;
if([imaged respondsToSelector:@selector(imageWithRenderingMode:)])
{
tabItem.image = [imaged imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
else
{
tabItem.image = imaged;
}
tabItem.selectedImage = imaged;
}
答案 0 :(得分:0)
试试这个,
用于设置选择指示器:
[[yourTabBarController tabBar] setSelectionIndicatorImage:[UIImage imageNamed:ImageName]];
要设置标签栏图标,请使用以下代码:
yourTabBarController.ViewController[0].tabBarItem = [[UITabBarItem alloc] initWithTitle:TitleForTabItem image:[[UIImage imageNamed:FirstTabIconImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[UIImage imageNamed:FirstTabIconImage]];
也可以将此设置标签栏项用于其他viewControllers。
继续......:)