Uitabbarcontroller: Tab bar controller, inherit from Uiviewcontroller, manage view controller in the form of tab bar, the corresponding view controller of each tab bar is independent, do not affect each other, click the tab bar, display the corresponding view controller of the tab bar, The life cycle of each view controller is consistent with the life cycle of the tabbarcontroller making the modules low-coupling, easy for team development, adding and removing modules as needed at any time
Creates a Tabbaritem object that specifies its caption, picture, and picture when it is selected
Uitabbaritem *item3=[[uitabbaritem alloc]initwithtitle:@ "vc3" Image:[uiimage imagenamed:@ "Tab_2.png"] selectedImage : [UIImage imagenamed:@ "Tab_s.png"];
Using the system's own style to create the Tabbaritem object, set the tag value, generally do not, you can not modify the title
Uitabbaritem *item4=[[uitabbaritem Alloc]initwithtabbarsystemitem:uitabbarsystemitembookmarks Tag:4];
VC3.TABBARITEM=ITEM4;
Tabbarcontroller can manage any Uiviewcontroller object when Tabbarcontroller manages more than 5 view controllers, a Morenavigationcontroller object is generated. Displays items after 5th and 5th in the form of a list the order of the view controller in the array is consistent with the order in which it is displayed
Nsarray *[email PROTECTED][NAV1,VC2,VC3,VC4,VC5,VC6];
Create a Uitabbarcontroller object
Uitabbarcontroller *tabbarcontroller=[[uitabbarcontroller Alloc]init];
Set Tabbarcontroller Managed View Controller object (array, any Uiviewcontroller object can be added to the array)
Tabbarcontroller.viewcontrollers=viewcontrollers;
Sets the subscript for the selected tab bar item, which shows the view of the first tab bar item object by default
Tabbarcontroller.selectedindex=1;
Set the selected View Controller object
TABBARCONTROLLER.SELECTEDVIEWCONTROLLER=VIEWCONTROLLERS[2];
Remove the title of the last user-selected view controller from Userdefaults
Nsuserdefaults *userdefaults=[nsuserdefaults Standarduserdefaults];
NSString *title=[userdefaults Objectforkey:titlekey];
Nsarray *array=[userdefaults Objectforkey:groupkey];
Set the background color of Tabbar
Tabbarcontroller.tabbar.bartintcolor=[uicolor Redcolor];
Set the color on the item selected on the Tabbar
Tabbarcontroller.tabbar.tintcolor=[uicolor Greencolor];
The height of the Tabbar is 49 pixels.
Cannot modify item on Tabbar
Uitabbarcontroller of UI controls