子控制器模型

来源:互联网 发布:淘宝开店书籍推荐 编辑:程序博客网 时间:2024/06/05 23:39

-(void)addChildViewController:(UIViewController *)childCtrl imageName:(NSString *)imageName title:(NSString *)title {

    

    //    UITabBarController * homeTbc = [UITabBarController new];

    childCtrl.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    childCtrl.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"%@_highlighted", imageName]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    childCtrl.tabBarItem.title = title;

    

    NSMutableDictionary * dic = [NSMutableDictionary dictionary];

    dic[NSForegroundColorAttributeName] = [UIColor orangeColor];

    //指定选中状态下文字颜色

    [childCtrl.tabBarItem setTitleTextAttributes:dic forState:UIControlStateSelected];

    

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

    

    [self addChildViewController:nav];

    

    

}

0 0
原创粉丝点击