iOS7
UIToolbar
UINavigationBar
transparency
iOS development

How to draw a transparent UIToolbar or UINavigationBar in iOS7

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

In iOS 7, transparent bars became part of the new visual style, but getting a truly clear UINavigationBar or UIToolbar took more than setting one color property. You usually needed to remove the default background image, remove the shadow image, and keep the bar translucent so content could show through.

What "transparent" means for iOS bars

In practice, there are two related effects. A translucent bar lets background content appear underneath with the system blur style. A fully transparent-looking bar removes the default chrome almost entirely so the content behind it becomes visually dominant.

The important part is that barTintColor = [UIColor clearColor] alone is usually not enough. The navigation bar and toolbar still draw their own background and shadow unless you replace those assets.

A practical setup in Objective-C

The standard technique is to provide an empty background image and an empty shadow image, then keep the bar translucent.

objective-c
1- (UIImage *)clearImage {
2    UIGraphicsBeginImageContextWithOptions(CGSizeMake(1.0, 1.0), NO, 0.0);
3    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
4    UIGraphicsEndImageContext();
5    return image;
6}
7
8- (void)viewDidLoad {
9    [super viewDidLoad];
10
11    UIImage *clear = [self clearImage];
12
13    [self.navigationController.navigationBar setBackgroundImage:clear
14                                                  forBarMetrics:UIBarMetricsDefault];
15    [self.navigationController.navigationBar setShadowImage:clear];
16    [self.navigationController.navigationBar setTranslucent:YES];
17
18    [self.toolbar setBackgroundImage:clear
19                  forToolbarPosition:UIBarPositionAny
20                          barMetrics:UIBarMetricsDefault];
21    [self.toolbar setShadowImage:clear
22              forToolbarPosition:UIBarPositionAny];
23    [self.toolbar setTranslucent:YES];
24}

This removes the standard bar artwork while preserving the translucent behavior that lets the interface feel layered instead of boxed in.

Why layout adjustment matters

Once the bar becomes transparent, your content may extend underneath it. That is often the desired effect, but it changes how the top of the view should be laid out. On iOS 7, this is where developers ran into overlapping titles, hidden buttons, or scroll views that started at the wrong vertical offset.

If the content should flow under the bar, keep the extended layout behavior and adjust insets appropriately. If the content should start below the bar, disable that extension or add the correct top inset manually.

The visual styling and the layout behavior are linked. A transparent bar without matching layout work usually looks broken rather than polished.

Toolbar and navigation bar differences

The same general trick works for both controls, but the APIs are not identical. UINavigationBar uses setBackgroundImage:forBarMetrics: and setShadowImage:. UIToolbar uses the toolbar-position variant of those methods. The concepts are the same even though the signatures differ.

That is why developers often think one bar "supports transparency" and the other does not. In reality, both can be styled this way, but each one needs the correct API calls.

Think about legibility

Making a bar transparent is easy to overdo. If the content behind the bar is visually busy, the title and bar button items can become hard to read. In that case, use tint colors deliberately or choose a semi-transparent background instead of a completely clear one.

Transparency is a design tool, not automatically a better design.

Common Pitfalls

  • Setting only barTintColor to clear and expecting the default background and shadow to disappear.
  • Forgetting the shadow image, which leaves a visible line even after the background looks clear.
  • Making the bar transparent without adjusting content layout or scroll view insets.
  • Assuming UINavigationBar and UIToolbar use the exact same styling API.
  • Ignoring contrast and ending up with unreadable titles or buttons over busy content.

Summary

  • In iOS 7, transparent bars usually require a clear background image plus a clear shadow image.
  • Keep the bar translucent so content can visually show through.
  • A clear-looking bar often changes layout because content may extend underneath it.
  • 'UINavigationBar and UIToolbar use similar ideas but different method signatures.'
  • Always check legibility after removing the default bar chrome.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.