How IOS uses Tabbarcontroller

Source: Internet
Author: User

I've built a lot of app templates in Xcode, but many times we need more flexibility in initializing projects. Let me briefly explain how to create a Tabbar app from 0.

    1. Create a project, because we write the program from the beginning, so theoretically there is no special requirements for the template. Here we choose Single View application template.
    2. Once the creation is complete, we can start writing the program. IOS apps are based on a uiwindows, so we just need to create a good one VC and then set the Rootviewcontroller of Windows to the current VC. Here is the code

‘‘‘

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
WORDLISTVC * ONEVC=[[WORDLISTVC alloc] init];
WORDLISTVC * TWOVC=[[WORDLISTVC alloc] init];
WORDLISTVC * THREEVC=[[WORDLISTVC alloc] init];
OneVC.tabBarItem.title = @Today's plan;
OneVC.tabBarItem.image = [UIImage imagenamed:@Plan-icon];
TwoVC.tabBarItem.title = @Vocabulary List;
TwoVC.tabBarItem.image = [UIImage imagenamed:@List-icon];
Self.placeholderVC.tabBarItem.title = @ ";
ThreeVC.tabBarItem.title = @
Unfamiliar vocabulary;
ThreeVC.tabBarItem.image = [UIImage imagenamed:@
Unfamiliar-words-icon];
Pvc.tabBarItem.title = @
Set up;
Pvc.tabBarItem.image = [UIImage imagenamed:@
Settings-icon "];
Uitabbarcontroller *tabbarcontroller = [[Uitabbarcontroller alloc]init];
Tabbarcontroller.delegate = self;
[Tabbarcontroller SETVIEWCONTROLLERS:@[ONEVC,TWOVC,THREEVC]];
[Tabbarcontroller setselectedindex:0];
TabbarController.tabBar.barTintColor = [Uicolor Whitecolor];
Self.tabbarcontroller = Tabbarcontroller;
Self.window.rootviewcontroller=self.tabbarcontroller;
return YES;
}
‘‘‘

How IOS uses Tabbarcontroller

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.