How to add separator between tabbar icon

543 views Asked by At

How to add a separator line between each icon for TabBar.

//TabbarViewController.h

    #import <UIKit/UIKit.h>
    @interface TabBarViewController : UITabBarController <UITabBarControllerDelegate>{ }
    @end

//TabbarViewController.m

- (void)viewDidLoad {
    [super viewDidLoad];
    HomeViewController *HomeViewController = [[HomeViewController alloc] init];
    UploadViewController *UploadViewController = [[UploadViewController alloc] init];
    MapViewController *mapviewController = [[MapViewController alloc]init];
    FavouriteViewController *favouriteViewController = [[FavouriteViewController alloc]init];
    
    HomeViewController.title = @"Home";
    UploadViewController.title = @"Upload";
    mapviewController.title = @"Map";
    favouriteViewController.title = @"Favourite";
    
    UINavigationController *homeNavCont = [[UINavigationController alloc] initWithRootViewController:HomeViewController];
    UINavigationController *secondNavCont = [[UINavigationController alloc] initWithRootViewController:UploadViewController];
    UINavigationController *thirdNavCont = [[UINavigationController alloc] initWithRootViewController:mapviewController];
    UINavigationController *fourthNavCont = [[UINavigationController alloc] initWithRootViewController:favouriteViewController];
    
    [[homeNavCont   tabBarItem] setImage:[UIImage imageNamed:@“Home32”]];
    [[secondNavCont tabBarItem] setImage:[UIImage imageNamed:@"camera32"]];
    [[thirdNavCont  tabBarItem] setImage:[UIImage imageNamed:@"Navigation32"]];
    [[fourthNavCont tabBarItem] setImage:[UIImage imageNamed:@"Faviourte32"]];
    
    HomeViewController.tabBarItem.selectedImage = [[UIImage imageNamed:@"Home32"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
        UploadViewController.tabBarItem.selectedImage = [[UIImage imageNamed:@"camera32"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    mapviewController.tabBarItem.selectedImage = [[UIImage imageNamed:@"Navigation32"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    favouriteViewController.tabBarItem.selectedImage = [[UIImage imageNamed:@"Faviourte32"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    self.viewControllers=[NSArray arrayWithObjects:homeNavCont,secondNavCont,thirdNavCont,fourthNavCont,nil];
    self.delegate = self;
    [self setSelectedIndex:0];
}

Need your advice for adding separator in between icons for tabbar.

TabBar Seperator

0

There are 0 answers