Translate

2016年1月8日 星期五

Objective-C - Changing Inactive UITabBarItem Image Colour

Objective-C - Changing Inactive UITabBar Image Colour

UIImage *img = [UIImage imageNamed:@"tab1.png"];
self.tabBarItem.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *selectimg =[UIImage imageNamed:@"tabselect1.png"];
self.tabBarItem.selectedImage = [selectimg imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

Remove UITabBarItem text, show only image

Remove UITabBarItem text, show only image/

NSInteger offset = 6;
UIEdgeInsets imageInset = UIEdgeInsetsMake(offset, 0, -offset, 0);
self.tabBarItem.imageInsets = imageInset;