首页 > 其他 > 详细

自定义tabBarItem选中和未选中的显示效果

时间:2015-11-30 19:46:09      阅读:261      评论:0      收藏:0      [点我收藏+]

以下代码是在TabBarViewController的ViewControllers的其中一个ViewController的viewDidLoad中写的!!!

 

    UIImage *image = [UIImage imageNamed:@"Heart"];

    //item未选中状态时,image不使用tintColor的颜色

    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

 

    //添加tabbarItem

    UITabBarItem *tabbarItem = [[UITabBarItem alloc] initWithTitle:@"育儿搜" image:image selectedImage:image];

 

    //设置item未选中状态时,title的颜色

    [tabbarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];

    self.tabBarItem = tabbarItem;

自定义tabBarItem选中和未选中的显示效果

原文:http://www.cnblogs.com/bigzhanglei/p/5007858.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!