i am creating a custom right bar button item for my navbar using the following code :
// create a toolbar
UIToolbar* tools = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 50, 44.01)];
// create the array to hold the button, which then gets added to the toolbar
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:1];
// create a toolbar item with image
NSString* pathToSettingsResourceFile = [[NSBundle mainBundle] pathForResource:@"19-gear" ofType:@"png"];
UIImage* settingsImage = [[[UIImage alloc] initWithContentsOfFile:pathToSettingsResourceFile] autorelease];
settings = [[UIBarButtonItem alloc]initWithImage:settingsImage style:UIBarButtonItemStylePlain target:self action:@selector(showSettings:)];
settings.enabled = FALSE;
// add button to toolbar
[buttons addObject:settings];
[tools setItems:buttons animated:NO];
[buttons release];
// add toolbar as a right bar button item
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:tools] autorelease];
[tools release];
until ios 6 this works as expected, from ios 6 i am getting this weird rectangle background
and adding
tools.opaque = NO;
tools.backgroundColor = [UIColor clearColor];
doesn't help,
please help me get rid of this background
Thanks in advance, Amit