bhupinder
bhupinder

Reputation: 335

Show UiView above all views

I am trying to show UIView above all navigationBar , status bar.

I tried options like setting navigation z position , adding UIView to UIWindow and adding UIView to NavigationController.

Add a UIView above all, even the navigation bar

Nothing worked for me.

My Application is on xcode 9.2 ,swift 4.0 , ios 11.

Upvotes: 0

Views: 1317

Answers (1)

Jay Patel
Jay Patel

Reputation: 2740

Add overlayView on main window:

if let window = UIApplication.shared.keyWindow {
    let overlayView = UIView()
    overlayView.frame = window.frame
    overlayView.backgroundColor = .red
    window.addSubview(overlayView)
}

Upvotes: 3

Related Questions