Xcode6 Custom Uitabbarcontroller

Source: Internet
Author: User

-(void) inittabbarview{if(Tabbarcontroller &&[KAPPDELEGATE.navigationController.viewControllers Containsobject:tabbarcontroller])        {[Kappdelegate.navigationcontroller poptoviewcontroller:tabbarcontroller animated:yes]; return;    } [Kappdelegate.navigationcontroller Poptorootviewcontrolleranimated:no];    [[UIApplication sharedapplication] setstatusbarhidden:no]; Nsmutablearray*controllers =[Nsmutablearray array]; //uiimagerenderingmodealwaysoriginal images are rendered as-is. {Schoolsecondhandviewcontroller*VC =[[Schoolsecondhandviewcontroller alloc] Initwithnibname:nil Bundle:nil]; Uitabbaritem*item = [[Uitabbaritem alloc] Initwithtitle:@"Home Page"Image:[[uiimage imagenamed:@"Tabbar_home"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] Selectedimage:[[uiimage imageNamed:@"tabbar_home_press"] [imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]]; [Item settitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [Uicolor Red        Color], nsforegroundcolorattributename, nil] forstate:uicontrolstatehighlighted]; Vc.tabbaritem=item;    [Controllers ADDOBJECT:VC]; } {Collectsomethingviewcontroller*VC =[[Collectsomethingviewcontroller alloc] Initwithnibname:nil Bundle:nil]; Uitabbaritem*item = [[Uitabbaritem alloc] Initwithtitle:@"Home Page"Image:[[uiimage imagenamed:@"Tabbar_home"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] Selectedimage:[[uiimage imageNamed:@"tabbar_home_press"] [imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]]; [Item settitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [Uicolor Red        Color], nsforegroundcolorattributename, nil] forstate:uicontrolstatehighlighted]; Vc.tabbaritem=item;            [Controllers ADDOBJECT:VC]; } {Losssomethingviewcontroller*VC =[[Losssomethingviewcontroller alloc] Initwithnibname:nil Bundle:nil]; Uitabbaritem*item = [[Uitabbaritem alloc] Initwithtitle:@"Home Page"Image:[[uiimage imagenamed:@"Tabbar_home"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] Selectedimage:[[uiimage imageNamed:@"tabbar_home_press"] [imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]]; [Item settitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [Uicolor Red        Color], nsforegroundcolorattributename, nil] forstate:uicontrolstatehighlighted]; Vc.tabbaritem=item;            [Controllers ADDOBJECT:VC]; } {Moreviewcontroller*VC =[[Moreviewcontroller alloc] Initwithnibname:nil Bundle:nil]; Uitabbaritem*item = [[Uitabbaritem alloc] Initwithtitle:@"Home Page"Image:[[uiimage imagenamed:@"Tabbar_home"] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] Selectedimage:[[uiimage imageNamed:@"tabbar_home_press"] [imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]]; [Item settitletextattributes:[nsdictionary Dictionarywithobjectsandkeys: [Uicolor Red        Color], nsforegroundcolorattributename, nil] forstate:uicontrolstatehighlighted]; Vc.tabbaritem=item;            [Controllers ADDOBJECT:VC]; } Tabbarcontroller=[[Uitabbarcontroller alloc] Initwithnibname:nil Bundle:nil]; Tabbarcontroller.Delegate=Self ; TabBarController.tabBar.clipsToBounds=TRUE; {TabBarController.tabBar.tintColor=Kdefault_bg_color; [[Uitabbar appearance] Setbackgroundimage:[zqutiles imagewithcolor:kdefault_bg_color Size:CGSizeMake ( in,1)]];//setting the background, modifying the color is useless[[Uitabbar appearance] Setselectionindicatorimage:[zqutiles imagewithcolor:kdefault_bg_color size:CGSi Zemake ( in,1)]];    } [Tabbarcontroller setviewcontrollers:controllers]; [Kappdelegate.navigationcontroller Pushviewcontroller:tabbarcontroller animated:yes];}

Xcode6 Custom Uitabbarcontroller

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.