I have a tab bar controller (its a tab bar based application, so tab bar is on MainWindow.xib). In this xib, I have added 4 tab bar items and I have set the image of all tab
Based on http://blog.theanalogguy.be/ works for me. Add the category UItabBarItem (CustomUnselectedImage) - haven't effect =(
the *.h
@interface CustomTabBarItem : UITabBarItem {
UIImage *customHighlightedImage;
UIImage *customNormalImage;
}
@property (nonatomic, retain) UIImage *customHighlightedImage;
@property (nonatomic, retain) UIImage *customNormalImage;
- (id)initWithTitle:(NSString *)title
normalImage:(UIImage *)normalImage
highlightedImage:(UIImage *)highlightedImage
tag:(NSInteger)tag;
@end
and *.m
#import "CustomTabBarItem.h"
@implementation CustomTabBarItem
@synthesize customHighlightedImage;
@synthesize customNormalImage;
- (id)initWithTitle:(NSString *)title
normalImage:(UIImage *)normalImage
highlightedImage:(UIImage *)highlightedImage
tag:(NSInteger)tag{
[self initWithTitle:title
image:nil
tag:tag];
[self setCustomNormalImage:normalImage];
[self setCustomHighlightedImage:highlightedImage];
return self;
}
- (void) dealloc
{
[customHighlightedImage release];
customHighlightedImage=nil;
[customNormalImage release];
customNormalImage=nil;
[super dealloc];
}
-(UIImage *) selectedImage
{
return self.customHighlightedImage;
}
-(UIImage *) unselectedImage
{
return self.customNormalImage;
}
@end
happy coding =]-