Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在tabbar+nav的界面中,tabbar文字不显示 #21

Open
Kienty opened this issue May 15, 2019 · 0 comments
Open

在tabbar+nav的界面中,tabbar文字不显示 #21

Kienty opened this issue May 15, 2019 · 0 comments

Comments

@Kienty
Copy link

Kienty commented May 15, 2019

-(void)initTabBarController
{
// self.delegate = self;

UIViewController *homeVC = [[UIViewController alloc] init];
homeVC.title = @"测试1";
EasyNavigationController *homeNag = [self settingTabbarItemWithRootVC:homeVC img:@"tab_home_note" selectImg:@"tab_home_selected"];

UIViewController *discoveryVC = [[UIViewController alloc] init];
discoveryVC.title = @"测试2";
EasyNavigationController *workProNag = [self settingTabbarItemWithRootVC:discoveryVC img:@"tab_dynamic_note" selectImg:@"tab_dynamic_selected"];

UIViewController *orderVC = [[UIViewController alloc] init];
orderVC.title = @"测试3";
EasyNavigationController *processNag = [self settingTabbarItemWithRootVC:orderVC img:@"tab_chat_note" selectImg:@"tab_chat_selected"];

UIViewController *mineVC = [[UIViewController alloc] init];
mineVC.title = @"测试4";
EasyNavigationController *mineNav = [self settingTabbarItemWithRootVC:mineVC img:@"tab_mine_note" selectImg:@"tab_home_selected"];
//workProNag
self.viewControllers = @[homeNag,workProNag,processNag,mineNav];
self.selectedIndex = 0;

}

  • (EasyNavigationController *)settingTabbarItemWithRootVC:(id)VC img:(NSString *)imgStr selectImg:(NSString *)selectImg
    {
    EasyNavigationController *nag = [[EasyNavigationController alloc] initWithRootViewController:VC];
    [nag.tabBarItem setImage:[[UIImage imageNamed:imgStr] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [nag.tabBarItem setSelectedImage:[[UIImage imageNamed:selectImg] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [nag.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal];
    [nag.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateSelected];
    return nag;
    }

WeChat0f25a02cce1ad96603639ba7696ba786

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant