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.
- 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.
- 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