0
我创建了UITools并添加了UIbarbuttonitem init并将图像添加到了UIBarbutton。但图像显示为黑色和白色。UIBarbutton图像颜色不显示
如何更改我的图像的原始颜色。
我的代码是:
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];