Plz use above images.
And u need to create three classes
tabbar.h
tabbar.m
tabbar.xib
// tabbars.h
#import <UIKit/UIKit.h>
@interface tabbars : UIViewController <UITabBarControllerDelegate, UITabBarDelegate, UINavigationControllerDelegate>
{ UITabBarController *mytabBarController;
UITabBar *tabBar;
NSArray *tabBarConfig;
}
- (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur;
@end
// tabbars.m
//
// Created by Deepak Singh Rawat
//
#import "tabbars.h"
// classe i used to call on tab
#import "CallViewController.h"
#import "ContactViewController.h"
#import "RecordViewController.h"
#import "SettingViewController.h"
#import "AboutViewController.h"
// create and import classes according to your classes
@interface UITabBarItem (Private)
@property(retain, nonatomic) UIImage *selectedImage;
- (void)_updateView;
@end
@implementation UITabBar (ColorExtensions)
- (void)recolorItemsWithColor:(UIColor *)color shadowColor:(UIColor *)shadowColor shadowOffset:(CGSize)shadowOffset shadowBlur:(CGFloat)shadowBlur
{
CGColorRef cgColor = [color CGColor];
CGColorRef cgShadowColor = [shadowColor CGColor];
for (UITabBarItem *item in [self items])
if ([item respondsToSelector:@selector(selectedImage)] &&
[item respondsToSelector:@selector(setSelectedImage:)] &&
[item respondsToSelector:@selector(_updateView)])
{
CGRect contextRect;
contextRect.origin.x = 0.0f;
contextRect.origin.y = 0.0f;
contextRect.size = [[item selectedImage] size];
// Retrieve source image and begin image context
UIImage *itemImage = [item image];
CGSize itemImageSize = [itemImage size];
CGPoint itemImagePosition;
itemImagePosition.x = ceilf((contextRect.size.width - itemImageSize.width) / 2);
itemImagePosition.y = ceilf((contextRect.size.height - itemImageSize.height) / 2);
UIGraphicsBeginImageContext(contextRect.size);
CGContextRef c = UIGraphicsGetCurrentContext();
// Setup shadow
CGContextSetShadowWithColor(c, shadowOffset, shadowBlur, cgShadowColor);
// Setup transparency layer and clip to mask
CGContextBeginTransparencyLayer(c, NULL);
CGContextScaleCTM(c, 1.0, -1.0);
CGContextClipToMask(c, CGRectMake(itemImagePosition.x, -itemImagePosition.y, itemImageSize.width, -itemImageSize.height), [itemImage CGImage]);
//Setup the gradient...
//CGFloat components[8] = {0.0,0.4,1.0,0.2,0.0,0.6,1.0,1.0};
//CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
//CGGradientRef colorGradient = CGGradientCreateWithColorComponents(colorSpace, components, NULL, 2);
//CGContextDrawLinearGradient(c, colorGradient,CGPointZero,CGPointMake(0,contextRect.size.height),0);
// Fill and end the transparency layer
CGContextSetFillColorWithColor(c, cgColor);
contextRect.size.height = -contextRect.size.height;
CGContextFillRect(c, contextRect);
CGContextEndTransparencyLayer(c);
// Set selected image and end context
[item setSelectedImage:UIGraphicsGetImageFromCurrentImageContext()];
UIGraphicsEndImageContext();
// Update the view
[item _updateView];
}
}
@end
@implementation tabbars
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization.
}
return self;
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
mytabBarController = [[UITabBarController alloc] init];
mytabBarController.delegate = self;
NSMutableArray *controllerArray = [[[NSMutableArray alloc] initWithCapacity:[tabBarConfig count]] autorelease];
CallViewController *aboutUsController = [[CallViewController alloc] init];
aboutUsController.title = @"Call";
//aboutUsController.tabBarItem.title = @"hhhhh";
aboutUsController.tabBarItem.image = [UIImage imageNamed:@"ic1-blue.png"];
UINavigationController *abtUsNavController = [[[UINavigationController alloc] initWithRootViewController:aboutUsController] autorelease];
aboutUsController.navigationController.navigationBar.hidden=YES;
[controllerArray addObject:abtUsNavController];
[aboutUsController release];
ContactViewController *contactUsController = [[ContactViewController alloc] init];
contactUsController.title = @"Contact";
//contactUsController.tabBarItem.title = @"";
contactUsController.tabBarItem.image = [UIImage imageNamed:@"ic2-blue.png"];
UINavigationController *cntctUsNavController = [[[UINavigationController alloc] initWithRootViewController:contactUsController] autorelease];
contactUsController.navigationController.navigationBar.hidden=YES;
[controllerArray addObject:cntctUsNavController];
[cntctUsNavController release];
RecordViewController *homeController1 = [[RecordViewController alloc] init];
homeController1.title = @"Record";
//homeController.tabBarItem.title = @"Home";
homeController1.tabBarItem.image = [UIImage imageNamed:@"ic3-blue.png"];
UINavigationController *homeNavController1 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
homeController1.navigationController.navigationBar.hidden=YES;
[controllerArray addObject:homeNavController1];
[homeController1 release];
//added here
SettingViewController *homeController2 = [[SettingViewController alloc] init];
homeController2.title = @"Setting";
//homeController.tabBarItem.title = @"Home";
homeController2.tabBarItem.image = [UIImage imageNamed:@"ic4-blue.png"];
UINavigationController *homeNavController2 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
homeController2.navigationController.navigationBar.hidden=YES;
[controllerArray addObject:homeController2];
[homeController2 release];
AboutViewController *homeController3 = [[AboutViewController alloc] init];
homeController3.title = @"About";
//homeController.tabBarItem.title = @"Home";
homeController3.tabBarItem.image = [UIImage imageNamed:@"ic5-blue.png"];
UINavigationController *homeNavController3 = [[[UINavigationController alloc] initWithRootViewController:homeController1] autorelease];
homeController3.navigationController.navigationBar.hidden=YES;
[controllerArray addObject:homeController3];
[homeController3 release];
//added here
mytabBarController.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
mytabBarController.moreNavigationController.delegate = self;
mytabBarController.delegate = self;
mytabBarController.viewControllers = controllerArray;
mytabBarController.hidesBottomBarWhenPushed = YES;
mytabBarController.customizableViewControllers = controllerArray;
//mytabBarController.view.backgroundColor = [UIColor redColor];
[[mytabBarController tabBar] recolorItemsWithColor:[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"12.png"]] shadowColor:[UIColor clearColor] shadowOffset:CGSizeMake(0.0f, -1.0f) shadowBlur:3.0f];
[self.navigationController pushViewController:mytabBarController animated:NO];
[self.navigationController setNavigationBarHidden:YES];
[super viewDidLoad];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
Here its the output screen pic












