UITabBarController 更改tabbariteam上的选中图片

首先遵守“ UITabBarControllerDelegate ”协议

再在- (void)viewDidLoad {}方法中设置代理“ self.tabBarController.delegate = self; ”

最后执行代理方法

-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
    if (_sdCycleScrView.hidden == YES) {
        switch (tabBarController.selectedIndex) {
            case 0:
            {
                UINavigationController *nav = tabBarController.viewControllers[0];
                if (inputview.hidden == YES) {
                    inputview.hidden = NO;
                    nav.tabBarItem.selectedImage = [[UIImage imageNamed:@"call_2@2x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
                }else{
                    inputview.hidden = YES;
                    nav.tabBarItem.selectedImage = [[UIImage imageNamed:@"call_3@2x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
                }
            }
                break;
            default:
                break;
        }
    }
}

上一篇:VS 测试printf 多参数 输出 i++ 和++i 结果


下一篇:Linux下tar-rar-unrar解压/压缩缩命令大全