Velmurugan
Velmurugan

Reputation: 2303

UIBarbutton Image color not display

I created UITools and add UIbarbuttonitem init and I add images to UIBarbutton. But images are dispalyed as Black and white.

How to change my image original color.

My code is:

UIToolbar *tools1 = [[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 70, 44.5)]autorelease];
NSMutableArray* buttons1 = [[NSMutableArray alloc] initWithCapacity:2];
    UIBarButtonItem* bi1 = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"searchicon.png"] style:UIBarButtonItemStylePlain target:self action:@selector(search:)];
    [buttons1 addObject:bi1];
    [bi1 release];
bi1 = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Star.png"] style:UIBarButtonItemStylePlain target:self action:@selector(ShowFav:)];
[buttons1 addObject:bi1];
[bi1 release];
[tools1 setItems:buttons1 animated:NO];
[buttons1 release];
tools1.tintColor=[UIColor blackColor];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:tools1];
    [tools1 release];

Upvotes: 0

Views: 1074

Answers (1)

John Parker
John Parker

Reputation: 54445

UIButtonBar images are always displayed as greyscale (with the system applied blue tint), with the alpha level in the source image used to determine the selected and un-selected images.

If you want to create your own custom tab bar with full colo(u)r icons, etc. there are a few approaches, as discussed in this question: Custom colors in UITabBar

Upvotes: 3

Related Questions