A good article with iOS6 style flat: http://www.tuicool.com/articles/6NFfYj
[[Uitabbar appearance] Setbackgroundimage:[[uiimage alloc] init]; Remove the black background from the back or
[[[Uitabbar appearance] Settintcolor:[uicolor Clearcolor]]; Remove the upper soiled edge
[[[Uitabbar Appearance]setshadowimage:[[uiimagealloc]init]]; Remove the shallow shadow above.
IOS7 compatible iOS6 selected pictures
Uitabbaritem *item = [[uitabbaritemalloc]initwithtitle:@ "Live" image:[uiimageimagenamed:@ "tab_icon_home_normal"] tag : 0];
if ([[[[Uidevicecurrentdevice]systemversion]floatvalue] >= 7.0)
{
[itemsetselectedimage:[uiimageimagenamed:@ "tab_icon_home_selected"]];
}
Else
{
[itemsetfinishedselectedimage:[uiimageimagenamed:@ "tab_icon_home_selected"]withfinishedunselectedimage:[ uiimageimagenamed:@ "Tab_icon_home_normal"]];
}
The following is a flat code for the iOS6 Navigationbar and Tabbar styles.
1, the Uinavigationbar and Uitabbar of the global style changes, written in the Appdelegate launchfinish
-(void) setupuiappearance {[[Uitabbar appearance] Setselectedimagetintcolor:[uicolor colorwithred:81.0/255 Green
: 196.0/255 blue:212.0/255 alpha:1]]; [[Uitabbaritem appearance] Settitletextattributes: @{uitextattributetextshadowoffset: [NSValue valueWithUIOffset:
Uioffsetmake (0, 0)], uitextattributetextcolor: [Uicolor Lightgraycolor]} forstate:uicontrolstateselected]; [[Uitabbaritem appearance] Settitletextattributes: @{uitextattributetextshadowoffset: [NSValue valueWithUIOffset:
Uioffsetmake (0, 0)], uitextattributetextcolor: [Uicolor Lightgraycolor]} Forstate:uicontrolstatenormal];
Uicolor *navigationbarcolor = [Uicolor colorwithred:81.0/255 green:196.0/255 blue:212.0/255 alpha:1]; if (Floor (nsfoundationversionnumber) <= nsfoundationversionnumber_ios_6_1) {[[Uitabbar appearance]
Setbackgroundimage:[[uiimage alloc] init];
[[Uitabbar appearance] Setshadowimage:[[uiimage alloc] init]; [[Uitabbar appearance] Setselectedimagetintcolor:[uicOlor Clearcolor]];
[[Uinavigationbar appearance] settintcolor:navigationbarcolor];
[[Uinavigationbar appearance] Setbackgroundimage:[[uiimage alloc] init] forbarmetrics:uibarmetricsdefault]; [[Uibarbuttonitem appearance] Setbackgroundimage:[uiimage new] Forstate:uicontrolstatenormal BarM
Etrics:uibarmetricsdefault];
[[Uinavigationbar appearance] Setbackgroundimage:[uiimage imagewithcolor:navigationbarcolor size:CGSizeMake (1, 44)]
Forbarmetrics:uibarmetricsdefault]; [[Uinavigationbar appearance] Settitletextattributes: @{nsforegroundcolorattributename: [UIColor WhiteColor], NSFon Tattributename: [Uifont boldsystemfontofsize:20], uitextattributetextshadowoffset: [Nsvalue valueWithUIOffset:
Uioffsetzero]}];
[[Uibarbuttonitem appearance] Settitletextattributes: @{uitextattributefont: [Uifont systemfontofsize:17], Uitextattributetextshadowoffset: [Nsvalue Valuewithuioffset:uioffsetzero]} forstate:uicontrolstatenOrmal];
[[Uitabbar appearance] Setbackgroundimage:[uiimage imagewithcolor:[uicolor Whitecolor] Size:CGSizeMake (1, 49)]];
[[Uitabbar appearance] setselectionindicatorimage:[uiimage new]; else {[[Uinavigationbar appearance] Setbartintcolor:[uicolor colorwithred:81.0/255 green:196.0/255 blue:212.0/255 A
Lpha:1]];
}
}
2, Tabbar picture set as follows
-(void) setuptabbaritemsandviewcontrollers {nsmutablearray *mutabletabbaritems = [Nsmutablearray array];
Nsmutablearray *mutableviewcontrollers = [Nsmutablearray array]; Ccmoreoptionsviewcontroller *moreoptionsviewcontroller = [[Ccmoreoptionsviewcontroller alloc] InitWithNibName:nil
Bundle:nil];
for (Nsinteger i = 0; i < Cc_tab_bar_item_type_total_number. i++) {switch (i) {case cctabbaritemtypeliveshow: {Uitabbaritem *item = [[Uitabbaritem alloc] initwithtitle:@ "xxxx" image:[uiimage imagenamed:@ "Tab_icon_home_normal"
] tag:0]; if ([[[[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {[Item setselectedimage:[uiimage imagenamed:
@ "tab_icon_home_selected"]]; else {[item setfinishedselectedimage:[uiimage imagenamed:@ ' tab_icon_home_selected '] withfinishedunselected
Image:[uiimage imagenamed:@ "Tab_icon_home_normal"];
} [Mutabletabbaritems Addobject:item]; Uinavigationcontroller *VC = [[Uinavigationcontroller Alloc] Initwithrootviewcontroller:moreoptionsviewcontroller];
Vc.tabbaritem = Item;
[Mutableviewcontrollers ADDOBJECT:VC];
Break Case Cctabbaritemtypemessage: {uitabbaritem *item = [[Uitabbaritem alloc] initwithtitle:@ "message" Image:[uiimage
imagenamed:@ "Tab_icon_message_normal"] tag:1]; if ([[[[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {[Item setselectedimage:[uiimage imagenamed:
@ "tab_icon_message_selected"]]; else {[item setfinishedselectedimage:[uiimage imagenamed:@ ' tab_icon_message_selected '] Withfinishedunselec
Tedimage:[uiimage imagenamed:@ "Tab_icon_message_normal"];
} [Mutabletabbaritems Addobject:item];
Uinavigationcontroller *VC = [[Uinavigationcontroller alloc] initwithrootviewcontroller:moreoptionsviewcontroller];
Vc.tabbaritem = Item;
[Mutableviewcontrollers ADDOBJECT:VC];
Break Case Cctabbaritemtypemobilegamevideo: {uitabbaritem *item = [Uitabbaritem AllOC] initwithtitle:@ "xxxx" image:[uiimage imagenamed:@ "Tab_icon_video_normal"] tag:1]; if ([[[[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {[Item setselectedimage:[uiimage imagenamed:
@ "tab_icon_video_selected"]]; else {[item setfinishedselectedimage:[uiimage imagenamed:@ ' tab_icon_video_selected '] withfinishedunselecte
Dimage:[uiimage imagenamed:@ "Tab_icon_video_normal"];
} [Mutabletabbaritems Addobject:item];
Uinavigationcontroller *VC = [[Uinavigationcontroller alloc] initwithrootviewcontroller:moreoptionsviewcontroller];
Vc.tabbaritem = Item;
[Mutableviewcontrollers ADDOBJECT:VC];
Break Case cctabbaritemtypemoreoptions: {uitabbaritem *item = [[Uitabbaritem alloc] initwithtitle:@ "More" image:[uiim
Age imagenamed:@ "Tab_icon_more_normal"] tag:1]; if ([[[[[[Uidevice Currentdevice] systemversion] floatvalue] >= 7.0) {[Item setselectedimage:[uiimage imagenamed:
@ "tab_icon_more_selected"]]; else {[item setfinishedselectedimage:[uiimage imagenamed:@ ' tab_icon_more_selected '] Withfinishedunselec
Tedimage:[uiimage imagenamed:@ "Tab_icon_more_normal"];
} [Mutabletabbaritems Addobject:item];
Uinavigationcontroller *VC = [[Uinavigationcontroller alloc] initwithrootviewcontroller:moreoptionsviewcontroller];
Vc.tabbaritem = Item;
[Mutableviewcontrollers ADDOBJECT:VC];
Break
} Default:break;
} self.viewcontrollers = Mutableviewcontrollers;
}
3, set Navigationbar as follows
-(void) Setupnavigationbar
{
BOOL islogin = YES;
if (IsLogin)
{
CGRect rect = cgrectmake (0, 0, a);
UIButton *headphotobutton = [[UIButton alloc] initwithframe:rect];
[Headphotobutton setimage:[uiimage imagenamed:@ "Icon_default_avatar"] forstate:uicontrolstatenormal];
UIButton *historybutton = [[UIButton alloc] initwithframe:rect];
[Historybutton setimage:[uiimage imagenamed:@ "Nav_icon_history_normal"] forstate:uicontrolstatenormal];
UIButton *searchbutton = [[UIButton alloc] initwithframe:rect];
[SearchButton setimage:[uiimage imagenamed:@ "Nav_icon_search_normal"] forstate:uicontrolstatenormal];
[Self.navigationitem Setleftbarbuttonitem:[[uibarbuttonitem alloc] Initwithcustomview:headphotobutton]];
[Self.navigationitem setrightbarbuttonitems:[nsarray Arraywithobjects:[[uibarbuttonitem alloc] InitWithCustomView: Historybutton],[[uibarbuttonitem Alloc] Initwithcustomview:searchbutton], nil]];
else
{
}
}
The result diagram is as follows
、