"iOS Dev-78" implemented in code Uitabbarcontroller+uinavigationcontroller

Source: Internet
Author: User


#import "WPTabBarController.h" #import "WPFirstViewController.h" #import "WPSecondViewController.h" #import " WPThirdViewController.h "#import" WPFourthViewController.h "@interface Wptabbarcontroller () @end @implementation    wptabbarcontroller-(void) viewdidload {wpfirstviewcontroller *firsvc=[[wpfirstviewcontroller alloc]init];    Wpsecondviewcontroller *secondvc=[[wpsecondviewcontroller Alloc]init];    Wpthirdviewcontroller *thirdvc=[[wpthirdviewcontroller Alloc]init];        Wpfourthviewcontroller *fourthvc=[[wpfourthviewcontroller Alloc]init];    The following two ways can be set on the title of Tabbar [email protected] "message";    [email protected] "message";    [email protected] "contact";    [email protected] "contact";    [email protected] "dynamic";    [email protected] "dynamic";    [email protected] "settings";    [email protected] "settings";    Set icon firsvc.tabbaritem.image=[uiimage imagenamed:@ "Tab_recent_nor"];    Secondvc.tabbaritem.image=[uiimage imagenamed:@ "Tab_buddy_nor"]; Thirdvc.tabbariteM.image=[uiimage imagenamed:@ "Tab_qworld_nor"];        Fourthvc.tabbaritem.image=[uiimage imagenamed:@ "Tab_me_nor"];    Firsvc.view.backgroundcolor=[uicolor Redcolor];    Secondvc.view.backgroundcolor=[uicolor Whitecolor];    Thirdvc.view.backgroundcolor=[uicolor Purplecolor];            Fourthvc.view.backgroundcolor=[uicolor Greencolor];    Add a child controller in the following ways//[email protected][firsvc,secondvc,thirdvc,fourthvc];    [Self addchildviewcontroller:firsvc];    [Self ADDCHILDVIEWCONTROLLER:SECONDVC];    [Self ADDCHILDVIEWCONTROLLER:THIRDVC];        [Self ADDCHILDVIEWCONTROLLER:FOURTHVC];    [Super Viewdidload]; Do any additional setup after loading the view.}

Core:

--Define 1 Tabbat controllers and 4 navigation controllers, then add 4 navigation controllers to the Tabbar controller in the form of a addchildviewcontroller or an array.

--Each navigation controller uses the Tabbaritem property to set the title, icon, and so on.

Screen screenshot:



"iOS Dev-78" implemented in code Uitabbarcontroller+uinavigationcontroller

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.