How to make UIToolbar's background transparent?
ios, objective-c, uitoolbar, uiview
Solution
If you want toolbar as Transparent :
[toolBar setBackgroundImage:[[UIImage alloc] init] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
and if you want toolbar as Translucent :
[toolBar setBarStyle:UIBarStyleBlack];
toolBar.translucent = YES;
Hope it helps you.
Problem
I want to make my UIToolBar have a transparent background (similar to iBooks) but I'm having no luck with setting the `translucent` property. Here's my code: ``` UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; NSMutableArray *toolBarItems = [[NSMutableArray alloc] init]; [toolBarItems addObject:[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:nil action:nil]]; [toolBarItems addObject:[[UIBarButtonItem alloc] initWithTitle:@"Source" style:UIBarButtonItemStyleBordered target:nil action:nil]]; [toolBarItems addObject:[[UIBarButtonItem alloc] initWithTitle:@"Aa" style:UIBarButtonItemStyleBordered target:nil action:nil]]; [toolBarItems addObject:[[UIBarButtonItem alloc] initWithTitle:@"Rabbit" style:UIBarButtonItemStyleBordered target:nil action:nil]]; toolBar.items = toolBarItems; toolBar.translucent = YES; [self.view addSubview:toolBar]; ``` It still comes out like this: