Add a UIView above all, even the navigation bar
You can do that by adding your view directly to the keyWindow:
UIView *myView = /* <- Your custom view */;
UIWindow *currentWindow = [UIApplication sharedApplication].keyWindow;
[currentWindow addSubview:myView];
UPDATE -- For Swift 4.1 and above
let currentWindow: UIWindow? = UIApplication.shared.keyWindow
currentWindow?.addSubview(myView)
UPDATE for iOS13 and above
keyWindow
is deprecated. You should use the following:
UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.addSubview(myView)
[self.navigationController.view addSubview:overlayView];
is what you really want
Here is a simple elegant solution that is working for me. You can set the z position of the navigation bar to below the view:
self.navigationController.navigationBar.layer.zPosition = -1;
Just remember to set it back to 0 when done.