Settings of iOS Tabbar
In fact, the customization of iOS Tabbar is very high, and we do not need to duplicate the wheel. Below are some common settings of tabbar collected by the author, I hope to help you.
Set the selected color of tabbar
The iOS7 settings are as follows:
[Self. tabBarController. tabBarsetSelectedImageTintColor: [UIColor greenColor];
The following settings are available in ios8:
Self. tabBar. tintColor = [UIColor greenColor];
Eliminate the tabbar border
At the startup of the appdelegate program:
[[UITabBar appearance] setShadowImage: [[UIImage alloc] init];
[[UITabBar appearance] setBackgroundImage: [[UIImage alloc] init];
Set the original and original tabbar item icons instead of the automatically filled color.
// Get the TabBar and get the expected item UITabBar * tabBar = _ tabBarController. tabBar; UITabBarItem * item0 = [tabBar. items objectAtIndex: 0]; UITabBarItem * item1 = [tabBar. items objectAtIndex: 1]; UITabBarItem * item2 = [tabBar. items objectAtIndex: 2]; UITabBarItem * item3 = [tabBar. items objectAtIndex: 3]; // set item0.selectedImage = [[UIImage imageNamed: @ "recognize-1"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal] for the item; item0.image = [[UIImage imageNamed: @ "recognize"] imageWithRenderingMode: Batch]; item1.selectedImage = [[UIImage imageNamed: @ "life-1"] imageWithRenderingMode: Batch]; item1.image = [[UIImage imageNamed: @ "life"] imageWithRenderingMode: queue]; item2.selectedImage = [[UIImage imageNamed: @ "edit-1"] imageWithRenderingMode: queue]; item2.image = [[UIImage imageNamed: @ "edit"] imageWithRenderingMode: Batch]; item3.selectedImage = [[UIImage imageNamed: @ "setting-1"] imageWithRenderingMode: Batch]; item3.image = [[UIImage imageNamed: @ "setting"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
Set tabbar background image
UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Main_Screen_Width, 49)]; backView.backgroundColor = [UIColor redColor]; [self.tabBar insertSubview:backView atIndex:0]; self.tabBar.opaque = YES;