> 
> Thanks for this information. It did change the color of the TabBar.
> But the other question is still unanswered. Is it possible to change
> the TabBarItem's image colors? Instead of default gray (when not selected) 
> and blue (when selected)? How?
> 
Again, a little bit of a grey area as you are overriding private methods.  So, 
this very well could break in future updates.  Be warned.  But here is an 
example for your understanding-

Subclass  UITabBarItem and override the private method selectedImage.  

@interface GRCustomUITabBarItem : UITabBarItem 
{
        UIImage         *customHighlightedImage;
}

@property (nonatomic, retain) UIImage *customHighlightedImage;

@end

@implementation GRCustomUITabBarItem

@synthesize customHighlightedImage;

- (void) dealloc
{       
        [customHighlightedImage release]; customHighlightedImage=nil;
        [super dealloc];
}

-(UIImage *) selectedImage  
{
        return self.customHighlightedImage;
}

@end

Then in the init of each one of the viewControllers that corresponds to a tab, 
you setup the tabBarItem

// Customized Tab Bar Item
                
                GRCustomUITabBarItem *tabItem = [[GRCustomUITabBarItem alloc] 
initWithTitle:@"Home" image:[UIImage imageNamed:@"home.png"] tag:0];
                tabItem.customHighlightedImage=[UIImage 
imageNamed:@"Home-sel.png"];
                self.tabBarItem=tabItem;
                [tabItem release]; tabItem=nil;

The customHighlightedImage should be a png properly sized and colored as you 
like.  It will be used as-is and not recolored to the blue like normal.

Greg
MangoCode

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to