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];