通过渲染改变tabBarItem的背景图片

Posted 齐卓

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过渲染改变tabBarItem的背景图片相关的知识,希望对你有一定的参考价值。

UITabBarController *tabVC = [[UITabBarController alloc] init];

    TestVC *vc = [TestVC new];

    tabVC.tabBar.tintColor = [UIColor greenColor];

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];

    nav.tabBarItem.title = @"第一页";

    UIImage *img = [UIImage imageNamed:@"service_sel"];

    nav.tabBarItem.selectedImage = [img imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

    nav.tabBarItem.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

以上是关于通过渲染改变tabBarItem的背景图片的主要内容,如果未能解决你的问题,请参考以下文章