How to create transparent Status Bar and Navigation Bar in iOS?

You might have come across many application where the screen extends to complete screen i.e transparent Status Bar and transparent navigation bar.

Here we will be seeing how to create an application where the you’ll be having transparent status and navigation bar.

So let’s get started

Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “TransparentViews”

Step 2 − Embed the View Controller in Navigation Controller. Add Image View and shown and add image.

Step 3 − Run the application without adding any piece of code for making status and navigation bar transparent.

The screen looks like below

Step 4 − Now Open ViewController.swift and add following code in viewDidLoad method.

override func viewDidLoad(){
   self.navigationController!.navigationBar.setBackgroundImage(UIImage(), for: .default)
   self.navigationController!.navigationBar.shadowImage = UIImage()
   self.navigationController!.navigationBar.isTranslucent = true

Step 5 − Run the application

Updated on: 30-Jul-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started