修改tabbar背景图片
方法1:
//设置背景颜色,注意tabbar高度设置为49
                CGRect frame = CGRectMake(0, 0, self.view.bounds.size.width, 49);
                UIView *view = [[UIView alloc] initWithFrame:frame];
                UIColor *color = [[UIColor alloc] initWithRed:255.0
                                                                                                                                green:255.0
                                                                                                                                    blue:255.0
                                                                                                                                alpha:1.0];
                [view setBackgroundColor:color];
                [color release];
                [[[self defaultTabBarController] tabBar] insertSubview:view atIndex:0];
                [view release];

方法2:
//设置图片为背景,注意tabbar高度设置为49
                UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage p_w_picpathNamed: @"backgroundImage.png"]];
                img.frame = CGRectMake(0, 0,
                                 self.defaultTabBarController.tabBar.frame.size.width,                                             self.defaultTabBarController.tabBar.frame.size.height);
                img.contentMode = UIViewContentModeScaleToFill;
                [[[self defaultTabBarController] tabBar] insertSubview:img atIndex:0];
                [img release];


修改tabbar图片及背景图片

MyTabBarItem.h
@ interface MyTabBarItem : UITabBarItem {
@ private
        
        UIImageView *iconImageView;
        UIImage *selectedIconImage, *iconImage;
}

@property (nonatomic, retain) UIImage *selectedIconImage, *iconImage;

- ( void)setSelected:(BOOL)bo;
- ( void)setIconImage:(UIImage *)p_w_picpath;
- ( void)setSelectedIconImage:(UIImage *)p_w_picpath;

@end


MyTabBarItem.m
#import "MyTabBarItem.h"


@implementation MyTabBarItem

@synthesize selectedIconImage, iconImage;

- ( void)setSelected:(BOOL)bo
{
        UIView *_view = [self valueForKey: @"_view"];
         if( bo )
        {
                iconImageView.frame = CGRectMake(0, 0, selectedIconImage.size.width/2, selectedIconImage.size.height/2);
                iconImageView.center = CGPointMake(_view.frame.size.width/2, _view.frame.size.height/2);
                iconImageView.p_w_picpath = selectedIconImage;
        }
         else
        {
                iconImageView.frame = CGRectMake(0, 0, iconImage.size.width/2, iconImage.size.height/2);
                iconImageView.center = CGPointMake(_view.frame.size.width/2, _view.frame.size.height/2);
                iconImageView.p_w_picpath = iconImage;                
        }
}

- ( void)awakeFromNib
{
        [super awakeFromNib];
        iconImageView = [[[UIImageView alloc] init] autorelease];
        [[self valueForKey: @"_view"] addSubview:iconImageView];
}

- ( void)dealloc {
        [selectedIconImage release];
        [iconImage release];
        [super dealloc];
}

@end
 
- (void)viewDidLoad
//add pictures of tab bar
        NSArray *array = self.defaultTabBarController.tabBar.items;
    
        [[array objectAtIndex:0] setIconImage:[UIImage p_w_picpathNamed: @"btn_tab_recipes.png"]];
        [[array objectAtIndex:0] setSelectedIconImage:[UIImage p_w_picpathNamed: @"btn_tab_recipes_selected.png"]];
        [[array objectAtIndex:0] setSelected:YES];


- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

//set selected picture
        NSArray *array = self.defaultTabBarController.tabBar.items;
         for (MyTabBarItem *item in array) {
                [item setSelected:NO];
        }
    
        [[array objectAtIndex:defaultTabBarController.selectedIndex] setSelected:YES];