tabBar按钮设置

设置一定要在重写init方法里面!!

- (instancetype)init{

if (self= [super init]) {

//设置tabar

[self initailTabBar];

}

return self;

}

/**

*  初始化tabBar

*/

- (void)initailTabBar{

UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:AppLocalizedString(@"Merchant") image:[UIImage imageNamed:@"merchant_tab"] tag:kTabBarIndex_Merchant];

item.image = [UIImage imageNamed:@"merchant_tab"];

item.selectedImage = [[UIImage imageNamed:@"bottom_seller_click_ic"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

//    [item setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:                                          kMainColorOfApp, UITextAttributeTextColor, nil] forState:UIControlStateHighlighted];

[item setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kMainColorOfApp,NSForegroundColorAttributeName, nil] forState:UIControlStateHighlighted];

self.tabBarItem = item;

self.tabBarItem.tag = kTabBarIndex_Merchant;

}

你可能感兴趣的:(tabBar按钮设置)