Uitabbarcontroller of UI controls

Source: Internet
Author: User

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

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.