UITabBarController

UIViewController * home=[[UIViewController alloc]init];

home.tabBarItem.title=@"首页";//设置tabBar的标题 经常忘记

self.viewControllers

//设置图片不渲染

 

+(instancetype)imageWithOriginalName:(NSString *)imageName{

 

    UIImage *image=[UIImage imageNamed:imageName];

 

    return [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

 

}

 self.tabBar.tintColor = [UIColor colorWithHexString:BLUE_GREEN_COLOR];
       UITabBarController *tabBarController = (UITabBarController*)self;
    UITabBar *tabBar = tabBarController.tabBar;


    UITabBarItem *trainEnquiryItem  = [tabBar.items objectAtIndex:0];
    
    [trainEnquiryItem setTitle:@"查询"];
    [trainEnquiryItem setImage:[UIImage imageNamed:@"tet"]];
    [trainEnquiryItem setSelectedImage:[UIImage imageNamed:@"tet_hover"]];

       [[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil
forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:
           [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithHexString:BLUE_GREEN_COLOR],
 UITextAttributeTextColor, nil] forState:UIControlStateSelected];

 

 /** 消息 **/

    UIViewController * message=[[UIViewController alloc]init];

    message.tabBarItem.title=@"消息";

    message.tabBarItem.image=[UIImage imageNamed:@"tabbar_home"];

    message.tabBarItem.selectedImage=[UIImage imageWithOriginalName:@"tabbar_home_selected"];

    message.view.backgroundColor=[UIColor grayColor];

    message.tabBarItem.badgeValue=@"10";

//外观模式获取item 设置字体大小

 UITabBarItem * item=[UITabBarItem appearance];
    mutableDic[NSFontAttributeName]=sizeFont(13);
    [item setTitleTextAttributes:mutableDic forState:0];

posted @ 2016-07-06 23:21  阿法狗的世界  阅读(137)  评论(0)    收藏  举报