Use of IOS Tab Bar
It is generally used to switch between subtasks, views, or models within the same view.
An example of a tab bar is shown below:

Important Properties
- backgroundImage
- items
- selectedItem
Sample Code and Steps
- Create a new project, select Tabbed Application Tabbed Application, click Next, enter the project name and select create.
2. Here two view controllers are created by default and a tab bar is added to our application.
- AppDelegate.m didFinishLaunchingWithOptionsThe methods are as follows:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]
bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc]
initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc]
initWithNibName:@"SecondViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1,
viewController2];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
4. The two view controllers are assigned as the view controllers of the tab bar controller
5. Run the application to get the following result:
