Navigation Bar and Tabbar are commonly used for landscaping, which will be added later

Source: Internet
Author: User

The methods implemented in the Appdelegate file are:

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) Launchoptions

{

[ self customnavigationbar];

[ self customtabbar];

return YES;

}

Beautify Tabbar

-(void) customtabbar{

Uiedgeinsets standardedgeinsets = Uiedgeinsetsmake (Ten, ten, ten) ;

//Background map of the entire Tabbar

[[Uitabbar appearance] Setbackgroundimage:[[uiimage imagenamed:@ "Tabbar_back"] Resizableimagewithcapinsets:standardedgeinsets Resizingmode:uiimageresizingmodestretch]];

//Set the background image for each item on tab bar when selected

[[Uitabbar appearance] Setselectionindicatorimage:[uiimage imagenamed:@ "Tabbar_selected_back"];

//Set the position size color of the text on the tab bar item

[[Uitabbaritem appearance] Settitlepositionadjustment:uioffsetmake (0,-1)];

[[Uitabbaritem appearance]settitletextattributes:@{

Nsforegroundcolorattributename:[uicolor lightgraycolor],nsfontattributename:[uifont boldSystemFontOfSize:12 ]

} Forstate:uicontrolstatenormal];

[[Uitabbaritem appearance]settitletextattributes:@{

Nsforegroundcolorattributename:[uicolor whitecolor],nsfontattributename:[uifont boldSystemFontOfSize: ]

} forstate:uicontrolstateselected];

}




//Beautify navigation bar

-(void) customnavigationbar{

//Set background color

[[Uinavigationbar appearance] Setbartintcolor:[uicolor Blackcolor]];

//The text color of the status bar when the navigation bar is set

[[Uinavigationbar appearance] setbarstyle:uibarstyleblack];

//Set the background map of the navigation bar

//[[uinavigationbar appearance] setbackgroundimage:[uiimage imagenamed:@ "Navigationbardefault"] ForBarM Etrics:uibarmetricsdefault];

//Set the text color on the left and right buttons

[[Uinavigationbar appearance] Settintcolor:[uicolor Whitecolor]];

//Set the arrow style that appears in the Back button

[[Uinavigationbar appearance] Setbackindicatorimage:[uiimage imagenamed:@ "back_btn"];

[[Uinavigationbar appearance] Setbackindicatortransitionmaskimage:[uiimage imagenamed:@ "back_btn"];

//Set the text style of the middle title

Set Shadow color offset

Nsshadow *shadow = [[Nsshadow alloc]init];

Shadow.shadowcolor = [Uicolor Redcolor];

Shadow.shadowoffset = Cgsizemake (0, 1);

Nsdictionary *dictionary = [Nsdictionary dictionarywithobjectsandkeys:shadow,nsshadowattributename,[uicolor Whitecolor],nsforegroundcolorattributename,[uifont fontwithname:@ "Helveticaneue-condensedblack" size: ],nsfontattributename,nil];

[[Uinavigationbar appearance] settitletextattributes:dictionary];

}


The methods to be implemented in the controller are

-(ID) Initwithcoder: (Nscoder *) adecoder{

self = [super Initwithcoder:adecoder];

if (self) {

[self. Navigationcontroller.tabbaritem setimage:[uiimage imagenamed:@ "Tabbar_item_my_music"];


[self. Navigationcontroller.tabbaritem setselectedimage:[[uiimage imagenamed:@ "Tabbar_item_my_music_ Selected "] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];

}

return self;

}









Navigation Bar and Tabbar are commonly used for landscaping, which will be added later

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.