Hello to all. I need to close the white view when I click on the red view, but the red view should be on the whole screen, and it does not close the navigationBar. How to make the UIView full screen, including the topbar. Hiding navigaionBar can not be, because afterwards the view will not be red, but transparent with a shadow effect. Thank)) 
|
1 answer
I UIView say right away that displaying a UIView over a UINavigationBar is a bad idea. For this popup view controller better suited, but if you really need it, you can:
add subview in navigation bar:
guard let navigationBarView = navigationController?.view else { return } navigationBarView.addSubview(yourSubview) or add the view directly to the main window :
guard let mainWindowView = UIApplication.shared.keyWindow else { return } mainWindowView.addSubview(yourSubview) - thanks a lot, the way with the window fits. Why a bad idea? Imagine that there is a message in the white window, and instead of a red view there is a shadow or some kind of UIVisualEffect. and if this effect covers everything except the bar it will look awful - Andrew Gurew
- No, the idea of hiding the navigation bar is normal. doing wrong with sybview. For this invented
popover view controller. And it will automatically add the effect of blurring and darkening for the background. - Vasilii Muravev
|