首页 > 其他 > 详细

StoryBoard 设置TabBar SelectImage 和tintColor

时间:2015-06-24 22:40:08      阅读:195      评论:0      收藏:0      [点我收藏+]

技术分享

 

如图:StoryBoard 结构是 Tabbar + Navi + ViewController

需求:需要修改TabBar的Image 和SelectImage

 

设置Image 

技术分享

设置SelectImage 方式一

技术分享

设置SelectImage 方式二

新建一个 UITabBarController StoryBoard 中的TabBar Class选择 新建的UITabBarController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UITabBarItem *tabBarItem1 = [self.tabBar.items objectAtIndex:0];
    tabBarItem1.selectedImage = [UIImage imageNamed:@"menu01on"];
    
}

运行看选中的图片是OK 但是 图片颜色怎么是颜色。。。。。 不要着急 代码修改如下就OK了


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 设置TabBar tintColor
    // 方式一
    self.tabBar.tintColor = [UIColor colorWithRed:255/255 green:0/255 blue:0/255 alpha:1];
    
    // 方式二 Tab Bar User Defined Runtime Attributes
    /*Key Path:tintColor Type:Color Value:color*/
    
    // 方式一
    UITabBarItem *tabBarItem1 = [self.tabBar.items objectAtIndex:0];
    tabBarItem1.selectedImage = [UIImage imageNamed:@"menu01on"];
 
}

StoryBoard 设置TabBar SelectImage 和tintColor

原文:http://blog.csdn.net/u011068996/article/details/46625313

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