In fact, iOS Tabbar is very customizable, we do not need to repeat the wheel, the following is the author collects some of the tabbar commonly used settings, I hope to be helpful to everyone.
Set Tabbar selected color
The iOS7 settings are as follows:
[self. Tabbarcontroller. TabBarsetselectedimagetintcolor: [uicolor greencolor]];
iOS8 the following settings:
Self.tabbar.tintcolor=[uicolor Greencolor];
Remove Tabbar Border
At the beginning of the program at Appdelegate:
[[Uitabbar appearance] setshadowimage:[[uiimage Alloc]init]];
[[Uitabbar appearance] setbackgroundimage:[[uiimage Alloc]init]];
Set the Tabbar item original icon with the original selected icon instead of the system auto-fill Color
Get TabBar in Get want to the 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 the corresponding picture to item item0.selectedimage = [[UIImage imagenamed:@ "Recognize-1"] Imagewithrenderingmode: Uiimagerenderingmodealwaysoriginal];; Item0.image = [[UIImage imagenamed:@ "recognize"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; Item1.selectedimage = [[UIImage imagenamed:@ "life-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];; Item1.image = [[UIImage imagenamed:@ "Life"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]; Item2.selectedimage = [[UIImage imagenamed:@ "edit-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];; Item2.image = [[UIImage imagenamed:@ "edit] Imagewithrenderingmode:uiimagerenderingmodEalwaysoriginal]; Item3.selectedimage = [[UIImage imagenamed:@ "Setting-1"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal ];; Item3.image = [[UIImage imagenamed:@ "setting"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];
Set Tabbar background picture
UIView *backview = [[UIView alloc] Initwithframe:cgrectmake (0, 0, Main_screen_width,)]; Backview.backgroundcolor = [Uicolor redcolor]; [Self.tabbar Insertsubview:backview atindex:0]; Self.tabBar.opaque = YES;
Some settings for iOS Tabbar