通过渲染改变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];

posted @ 2017-04-24 10:01  鹰在北方  阅读(327)  评论(0编辑  收藏  举报