I want to add a UITabBarController to my application. But I have to do it with code only. No xib files or storyboards. How to do this entirely through code?
Add this code in your AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
FirstViewController * fvc=[[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
SecondViewController * svc=[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
ThirdViewController * tvc=[[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
FourthViewController * fvc2=[[FourthViewController alloc]initWithNibName:@"FourthViewController" bundle:nil];
tabbar=[[UITabBarController alloc]init];
tabbar.viewControllers=[NSArray arrayWithObjects:fvc,svc,tvc,fvc2,nil];
[self.window addSubview:tabbar.view];
}