#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