UITabBar的“更多”内没有彩色图标

时间:2014-01-08 08:45:28

标签: ios uitabbarcontroller

我获得了标签的彩色标签图标,如下面的屏幕截图所示。

enter image description here

但是当我点击更多并查看更多标签时,我没有获得彩色标签图标

enter image description here

如何获取“更多”标签的彩色标签图标?这是我在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;

        }

1 个答案:

答案 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。

继续......:)